home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / tool chest / communications toolbox / ctb development resources / commtoolbox roadmap / tm calls / cards.xml < prev    next >
Encoding:
Text File  |  1992-05-11  |  94.4 KB  |  1,690 lines

  1. card_12597.xml
  2. <?xml version="1.0" encoding="utf-8" ?>
  3. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  4. <card>
  5.     <id>12597</id>
  6.     <filler1>0</filler1>
  7.     <cantDelete> <false /> </cantDelete>
  8.     <showPict> <true /> </showPict>
  9.     <dontSearch> <false /> </dontSearch>
  10.     <owner>8636</owner>
  11.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  12.     <part>
  13.         <id>1</id>
  14.         <type>field</type>
  15.         <visible> <true /> </visible>
  16.         <dontWrap> <false /> </dontWrap>
  17.         <dontSearch> <false /> </dontSearch>
  18.         <sharedText> <false /> </sharedText>
  19.         <fixedLineHeight> <false /> </fixedLineHeight>
  20.         <autoTab> <false /> </autoTab>
  21.         <lockText> <true /> </lockText>
  22.         <rect>
  23.             <left>405</left>
  24.             <top>24</top>
  25.             <right>432</right>
  26.             <bottom>41</bottom>
  27.         </rect>
  28.         <style>opaque</style>
  29.         <autoSelect> <false /> </autoSelect>
  30.         <showLines> <false /> </showLines>
  31.         <wideMargins> <false /> </wideMargins>
  32.         <multipleLines> <false /> </multipleLines>
  33.         <reservedFamily> 0 </reservedFamily>
  34.         <titleWidth>0</titleWidth>
  35.         <icon>0</icon>
  36.         <textAlign>center</textAlign>
  37.         <font>Chicago</font>
  38.         <textSize>12</textSize>
  39.         <textStyle>plain</textStyle>
  40.         <textHeight>16</textHeight>
  41.         <name></name>
  42.         <script></script>
  43.     </part>
  44.     <content>
  45.         <layer>card</layer>
  46.         <id>1</id>
  47.         <text>OS</text>
  48.     </content>
  49.     <content>
  50.         <layer>background</layer>
  51.         <id>9</id>
  52.         <text><span class="style1">oolean    flag;
  53.  
  54. switch (event.what)
  55. {
  56.  
  57.   case osEvt:
  58.   {
  59.     flag = (event.message & resumeFlag) != 0;
  60.     </span><span class="style14"><a href="#" class="group">TMResume</a></span><span class="style1">(terminal, flag);
  61.   }
  62.   break;
  63.  
  64.  }
  65. </span></text>
  66.     </content>
  67.     <name>OS</name>
  68.     <script></script>
  69. </card>
  70.  
  71.  
  72. card_12422.xml
  73. <?xml version="1.0" encoding="utf-8" ?>
  74. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  75. <card>
  76.     <id>12422</id>
  77.     <filler1>0</filler1>
  78.     <cantDelete> <false /> </cantDelete>
  79.     <showPict> <true /> </showPict>
  80.     <dontSearch> <false /> </dontSearch>
  81.     <owner>8636</owner>
  82.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  83.     <part>
  84.         <id>1</id>
  85.         <type>field</type>
  86.         <visible> <true /> </visible>
  87.         <dontWrap> <false /> </dontWrap>
  88.         <dontSearch> <false /> </dontSearch>
  89.         <sharedText> <false /> </sharedText>
  90.         <fixedLineHeight> <false /> </fixedLineHeight>
  91.         <autoTab> <false /> </autoTab>
  92.         <lockText> <true /> </lockText>
  93.         <rect>
  94.             <left>394</left>
  95.             <top>24</top>
  96.             <right>447</right>
  97.             <bottom>41</bottom>
  98.         </rect>
  99.         <style>opaque</style>
  100.         <autoSelect> <false /> </autoSelect>
  101.         <showLines> <false /> </showLines>
  102.         <wideMargins> <false /> </wideMargins>
  103.         <multipleLines> <false /> </multipleLines>
  104.         <reservedFamily> 0 </reservedFamily>
  105.         <titleWidth>0</titleWidth>
  106.         <icon>0</icon>
  107.         <textAlign>center</textAlign>
  108.         <font>Chicago</font>
  109.         <textSize>12</textSize>
  110.         <textStyle>plain</textStyle>
  111.         <textHeight>16</textHeight>
  112.         <name></name>
  113.         <script></script>
  114.     </part>
  115.     <content>
  116.         <layer>card</layer>
  117.         <id>1</id>
  118.         <text>Menus</text>
  119.     </content>
  120.     <content>
  121.         <layer>background</layer>
  122.         <id>9</id>
  123.         <text>menuItem = MenuSelect(event.where);
  124. menu = HiWord(menuItem);
  125. item = LoWord(menuItem);
  126. switch (menu)
  127. {
  128.   case AppleMenu :
  129.   {
  130.     switch (item)
  131.     {
  132.       ‚Ķ
  133.     }
  134.   }
  135.   break;
  136.  
  137.   case FileMenu :
  138.   {
  139.     switch (item)
  140.     {
  141.       ‚Ķ
  142.     }
  143.   }
  144.   break;
  145.  
  146. …
  147. …
  148. …
  149.  
  150.   default :
  151.   {
  152.     if (! TMMenu(terminal, menu, item))
  153.     {
  154.       ‚Ķ
  155.     }
  156.   }
  157.   break;
  158. }
  159. </text>
  160.     </content>
  161.     <name>Menus</name>
  162.     <script></script>
  163. </card>
  164.  
  165.  
  166. card_8189.xml
  167. <?xml version="1.0" encoding="utf-8" ?>
  168. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  169. <card>
  170.     <id>8189</id>
  171.     <filler1>0</filler1>
  172.     <cantDelete> <false /> </cantDelete>
  173.     <showPict> <true /> </showPict>
  174.     <dontSearch> <false /> </dontSearch>
  175.     <owner>8636</owner>
  176.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  177.     <part>
  178.         <id>1</id>
  179.         <type>field</type>
  180.         <visible> <true /> </visible>
  181.         <dontWrap> <false /> </dontWrap>
  182.         <dontSearch> <false /> </dontSearch>
  183.         <sharedText> <false /> </sharedText>
  184.         <fixedLineHeight> <false /> </fixedLineHeight>
  185.         <autoTab> <false /> </autoTab>
  186.         <lockText> <true /> </lockText>
  187.         <rect>
  188.             <left>380</left>
  189.             <top>24</top>
  190.             <right>458</right>
  191.             <bottom>41</bottom>
  192.         </rect>
  193.         <style>opaque</style>
  194.         <autoSelect> <false /> </autoSelect>
  195.         <showLines> <false /> </showLines>
  196.         <wideMargins> <false /> </wideMargins>
  197.         <multipleLines> <false /> </multipleLines>
  198.         <reservedFamily> 0 </reservedFamily>
  199.         <titleWidth>0</titleWidth>
  200.         <icon>0</icon>
  201.         <textAlign>center</textAlign>
  202.         <font>Chicago</font>
  203.         <textSize>12</textSize>
  204.         <textStyle>plain</textStyle>
  205.         <textHeight>16</textHeight>
  206.         <name></name>
  207.         <script></script>
  208.     </part>
  209.     <content>
  210.         <layer>card</layer>
  211.         <id>1</id>
  212.         <text>Key Press</text>
  213.     </content>
  214.     <content>
  215.         <layer>background</layer>
  216.         <id>9</id>
  217.         <text>switch (event.what)
  218. {
  219.   case keyDown:
  220.   {
  221.     window = FrontWindow();
  222.     if (window == gWindow)
  223.     {
  224.       TMKey(gTerminal, &event);
  225.     }
  226.     else
  227.     if (terminal == (*window).refCon)
  228.     {
  229.       TMEvent(terminal, &event);
  230.     }
  231.   }
  232.   break;
  233. }
  234.  
  235.   
  236.   
  237. </text>
  238.     </content>
  239.     <name>Key</name>
  240.     <script></script>
  241. </card>
  242.  
  243.  
  244. card_12069.xml
  245. <?xml version="1.0" encoding="utf-8" ?>
  246. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  247. <card>
  248.     <id>12069</id>
  249.     <filler1>0</filler1>
  250.     <cantDelete> <false /> </cantDelete>
  251.     <showPict> <true /> </showPict>
  252.     <dontSearch> <false /> </dontSearch>
  253.     <owner>8636</owner>
  254.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  255.     <part>
  256.         <id>1</id>
  257.         <type>field</type>
  258.         <visible> <true /> </visible>
  259.         <dontWrap> <false /> </dontWrap>
  260.         <dontSearch> <false /> </dontSearch>
  261.         <sharedText> <false /> </sharedText>
  262.         <fixedLineHeight> <false /> </fixedLineHeight>
  263.         <autoTab> <false /> </autoTab>
  264.         <lockText> <true /> </lockText>
  265.         <rect>
  266.             <left>388</left>
  267.             <top>24</top>
  268.             <right>452</right>
  269.             <bottom>41</bottom>
  270.         </rect>
  271.         <style>opaque</style>
  272.         <autoSelect> <false /> </autoSelect>
  273.         <showLines> <false /> </showLines>
  274.         <wideMargins> <false /> </wideMargins>
  275.         <multipleLines> <false /> </multipleLines>
  276.         <reservedFamily> 0 </reservedFamily>
  277.         <titleWidth>0</titleWidth>
  278.         <icon>0</icon>
  279.         <textAlign>center</textAlign>
  280.         <font>Chicago</font>
  281.         <textSize>12</textSize>
  282.         <textStyle>plain</textStyle>
  283.         <textHeight>16</textHeight>
  284.         <name></name>
  285.         <script></script>
  286.     </part>
  287.     <content>
  288.         <layer>card</layer>
  289.         <id>1</id>
  290.         <text>Window</text>
  291.     </content>
  292.     <content>
  293.         <layer>background</layer>
  294.         <id>9</id>
  295.         <text>switch (event.what)
  296. {
  297.   case mouseDown:
  298.   {
  299.     switch (FindWindow(event.where, &window))
  300.     {
  301.       case inGoAway :
  302.       case inGrow :
  303.       case inZoomIn :
  304.       case inZoomOut :
  305.       case inContent :
  306.       {
  307.         if (window == gTerminalWindow)
  308.         {
  309.           TMClick(terminal, &event);
  310.         }
  311.         else
  312.         if (terminal == (*window).refCon)
  313.         {
  314.           TMEvent(terminal, &event);
  315.         }
  316.       }
  317.       break;
  318.     }
  319.   }
  320.   break;
  321.   
  322.   case updateEvt:
  323.   {
  324.     window = (WindowPeek) event.message;
  325.     if (window == gTerminalWindow)
  326.     {
  327.       SetPort(window);
  328.       BeginUpdate(window);
  329.         TMUpdate(terminal, 
  330.           (*(WindowPeek)window).port.visRgn);
  331.         DrawGrowIcon(window);
  332.         DrawControls(window);
  333.       EndUpdate(window);
  334.     }
  335.     else
  336.     if (terminal == (*window).refCon)
  337.     {
  338.       TMEvent(terminal, &event);
  339.     }
  340.   }
  341.   break;
  342.   
  343.   case activateEvt:
  344.   {
  345.     window = (WindowPeek) event.message;
  346.     if (window == gTerminalWindow)
  347.     {
  348.       TMActivate(terminal, 
  349.          event.modifiers & activeFlag);
  350.     }
  351.     else
  352.     if (terminal == (*window).refCon)
  353.     {
  354.       TMEvent(terminal, &event);
  355.     }
  356.   }
  357.   break;
  358.  
  359. }
  360.  
  361.   </text>
  362.     </content>
  363.     <name>Window</name>
  364.     <script></script>
  365. </card>
  366.  
  367.  
  368. card_8903.xml
  369. <?xml version="1.0" encoding="utf-8" ?>
  370. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  371. <card>
  372.     <id>8903</id>
  373.     <filler1>0</filler1>
  374.     <cantDelete> <false /> </cantDelete>
  375.     <showPict> <true /> </showPict>
  376.     <dontSearch> <false /> </dontSearch>
  377.     <owner>8636</owner>
  378.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  379.     <part>
  380.         <id>1</id>
  381.         <type>field</type>
  382.         <visible> <false /> </visible>
  383.         <dontWrap> <false /> </dontWrap>
  384.         <dontSearch> <false /> </dontSearch>
  385.         <sharedText> <false /> </sharedText>
  386.         <fixedLineHeight> <false /> </fixedLineHeight>
  387.         <autoTab> <false /> </autoTab>
  388.         <lockText> <false /> </lockText>
  389.         <rect>
  390.             <left>130</left>
  391.             <top>280</top>
  392.             <right>576</right>
  393.             <bottom>352</bottom>
  394.         </rect>
  395.         <style>scrolling</style>
  396.         <autoSelect> <false /> </autoSelect>
  397.         <showLines> <false /> </showLines>
  398.         <wideMargins> <false /> </wideMargins>
  399.         <multipleLines> <false /> </multipleLines>
  400.         <reservedFamily> 0 </reservedFamily>
  401.         <titleWidth>0</titleWidth>
  402.         <icon>0</icon>
  403.         <textAlign>left</textAlign>
  404.         <font>Geneva</font>
  405.         <textSize>9</textSize>
  406.         <textStyle>plain</textStyle>
  407.         <textHeight>12</textHeight>
  408.         <name>the 411 info</name>
  409.         <script></script>
  410.     </part>
  411.     <part>
  412.         <id>3</id>
  413.         <type>field</type>
  414.         <visible> <true /> </visible>
  415.         <dontWrap> <false /> </dontWrap>
  416.         <dontSearch> <false /> </dontSearch>
  417.         <sharedText> <false /> </sharedText>
  418.         <fixedLineHeight> <false /> </fixedLineHeight>
  419.         <autoTab> <false /> </autoTab>
  420.         <lockText> <true /> </lockText>
  421.         <rect>
  422.             <left>366</left>
  423.             <top>24</top>
  424.             <right>473</right>
  425.             <bottom>41</bottom>
  426.         </rect>
  427.         <style>opaque</style>
  428.         <autoSelect> <false /> </autoSelect>
  429.         <showLines> <false /> </showLines>
  430.         <wideMargins> <false /> </wideMargins>
  431.         <multipleLines> <false /> </multipleLines>
  432.         <reservedFamily> 0 </reservedFamily>
  433.         <titleWidth>0</titleWidth>
  434.         <icon>0</icon>
  435.         <textAlign>center</textAlign>
  436.         <font>Chicago</font>
  437.         <textSize>12</textSize>
  438.         <textStyle>plain</textStyle>
  439.         <textHeight>16</textHeight>
  440.         <name></name>
  441.         <script></script>
  442.     </part>
  443.     <content>
  444.         <layer>card</layer>
  445.         <id>3</id>
  446.         <text>Event Handling</text>
  447.     </content>
  448.     <content>
  449.         <layer>card</layer>
  450.         <id>1</id>
  451.         <text>√¶KY TMClick
  452. Mouse events
  453.  
  454. Procedure        TMClick(hTerm: TermHandle; theEvent: EventRecord);
  455.  
  456. Description:    TMClick processes a mouseDown vent in the terminal 
  457.                 emulation region. The routine pointed to by myclikLoop,
  458.                 discussed later in this chapter in the section ‚ÄúRoutines
  459.                 That Must Be in Your Application,‚Äù is called repeatedly
  460.                 by TMClick.
  461. •
  462. √¶KY TMEvent
  463. Other events
  464.  
  465. Procedure        TMEvent(hTerm: TermHandle; theEvent: EventRecord);
  466.  
  467. Description:    When your application receives an event, it should check
  468.                 whether the refcon of the window is a tool‚Äôs hTerm. Such
  469.                 an event occurs, for example, when the user clicks a
  470.                 button in a dialog box displayed by the terminal tool. 
  471.                 If it does belong to a terminal tool‚Äôs window, your 
  472.                 application can call TMEvent.    
  473.  
  474.                 A window (or dialog box) created by a terminal tool has
  475.                 a terminal record handle stored in the refCon field for 
  476.                 windowRecord.
  477. •
  478. √¶KY TMUpdate
  479. Update events
  480.  
  481. Procedure        TMUpdate(hTerm: TermHandle; visRgn: RgnHandle);
  482.  
  483. Description:    Your application will typically call TMUpdate between 
  484.                 BeginUpdate and EndUpdate.    
  485.  
  486.                 visRgn specifies the region to be updated.
  487. •
  488. √¶KY TMActivate
  489. Activate events
  490.  
  491. Procedure        TMActivate(hTerm: TermHandle; activate: BOOLEAN);
  492.  
  493. Description:    TMActivate processes an activate or deactivate event 
  494.                 (for instance, installing or removing a custom tool 
  495.                 menu) for a window associated with the terminal tool.
  496.  
  497.                 If activate is TRUE, the terminal tool processes an 
  498.                 activate event. Otherwise, it processes a deactivate 
  499.                 event.
  500. •
  501. √¶KY TMKey
  502. Keyboard events
  503.  
  504. Procedure        TMKey(hTerm: TermHandle; theEvent: EventRecord);
  505.  
  506. Description:    TMKey processes a keyDown or autoKey event. The terminal
  507.                 tool translates the keystroke into a sequence of bytes.
  508.                 The terminal tool then calls your application‚Äôs sendProc
  509.                 routine (discussed later in this chapter under ‚ÄúRoutines
  510.                 That Must Be in Your Application.‚Äù) to transmit this 
  511.                 sequence of bytes.
  512.  
  513.                 Your application can create its own event record for 
  514.                 specific keyboard events by filling in the event record
  515.                 with the character code and ‚Äì1 for the key code in the 
  516.                 message field.
  517. •
  518. √¶KY TMResume
  519. Resume events
  520.  
  521. Procedure        TMResume(hTerm: TermHandle; resume: BOOLEAN);
  522.  
  523. Description:    TMResume processes a resume or suspend event for a 
  524.                 terminal window. Resume and suspend events are processed
  525.                 only if a tool has a custom menu to install or remove 
  526.                 from the menu bar.
  527.  
  528.                 If resume is TRUE, then the terminal processes a resume
  529.                 event. Otherwise, it processes a suspend event.
  530. •
  531. √¶KY TMMenu
  532. Menu events
  533.  
  534. Function        TMMenu(hTerm: TermHandle; menuID: INTEGER; item: 
  535.                 INTEGER): BOOLEAN;
  536.  
  537. Description:    Your application must call TMMenu when the user chooses
  538.                 an item from a menu that is installed by the terminal 
  539.                 tool.
  540.  
  541.                 TMMenu returns FALSE if the terminal tool did not handle
  542.                 the menu event.    TMMenu returns TRUE if the terminal tool
  543.                 did handle the menu event.
  544. •
  545. </text>
  546.     </content>
  547.     <name>event</name>
  548.     <script></script>
  549. </card>
  550.  
  551.  
  552. card_12925.xml
  553. <?xml version="1.0" encoding="utf-8" ?>
  554. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  555. <card>
  556.     <id>12925</id>
  557.     <filler1>0</filler1>
  558.     <cantDelete> <false /> </cantDelete>
  559.     <showPict> <true /> </showPict>
  560.     <dontSearch> <false /> </dontSearch>
  561.     <owner>7555</owner>
  562.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  563.     <part>
  564.         <id>1</id>
  565.         <type>field</type>
  566.         <visible> <true /> </visible>
  567.         <dontWrap> <false /> </dontWrap>
  568.         <dontSearch> <false /> </dontSearch>
  569.         <sharedText> <false /> </sharedText>
  570.         <fixedLineHeight> <false /> </fixedLineHeight>
  571.         <autoTab> <false /> </autoTab>
  572.         <lockText> <true /> </lockText>
  573.         <rect>
  574.             <left>390</left>
  575.             <top>24</top>
  576.             <right>444</right>
  577.             <bottom>41</bottom>
  578.         </rect>
  579.         <style>opaque</style>
  580.         <autoSelect> <false /> </autoSelect>
  581.         <showLines> <false /> </showLines>
  582.         <wideMargins> <false /> </wideMargins>
  583.         <multipleLines> <false /> </multipleLines>
  584.         <reservedFamily> 0 </reservedFamily>
  585.         <titleWidth>0</titleWidth>
  586.         <icon>0</icon>
  587.         <textAlign>center</textAlign>
  588.         <font>Chicago</font>
  589.         <textSize>12</textSize>
  590.         <textStyle>plain</textStyle>
  591.         <textHeight>16</textHeight>
  592.         <name></name>
  593.         <script></script>
  594.     </part>
  595.     <content>
  596.         <layer>card</layer>
  597.         <id>1</id>
  598.         <text>Break</text>
  599.     </content>
  600.     <content>
  601.         <layer>background</layer>
  602.         <id>9</id>
  603.         <text>pascal void  MyBreakProc(
  604.                long duration, 
  605.                long refCon)
  606. {
  607.   long  a5;
  608.   
  609.   a5 = SetA5(refCon);
  610.   CMBreak(gConnection, duration, false, nil);
  611.   (void) SetA5(a5);
  612. }
  613. </text>
  614.     </content>
  615.     <name>break</name>
  616.     <script></script>
  617. </card>
  618.  
  619.  
  620. card_13679.xml
  621. <?xml version="1.0" encoding="utf-8" ?>
  622. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  623. <card>
  624.     <id>13679</id>
  625.     <filler1>0</filler1>
  626.     <cantDelete> <false /> </cantDelete>
  627.     <showPict> <true /> </showPict>
  628.     <dontSearch> <false /> </dontSearch>
  629.     <owner>7555</owner>
  630.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  631.     <part>
  632.         <id>1</id>
  633.         <type>field</type>
  634.         <visible> <true /> </visible>
  635.         <dontWrap> <false /> </dontWrap>
  636.         <dontSearch> <false /> </dontSearch>
  637.         <sharedText> <false /> </sharedText>
  638.         <fixedLineHeight> <false /> </fixedLineHeight>
  639.         <autoTab> <false /> </autoTab>
  640.         <lockText> <true /> </lockText>
  641.         <rect>
  642.             <left>373</left>
  643.             <top>24</top>
  644.             <right>467</right>
  645.             <bottom>41</bottom>
  646.         </rect>
  647.         <style>opaque</style>
  648.         <autoSelect> <false /> </autoSelect>
  649.         <showLines> <false /> </showLines>
  650.         <wideMargins> <false /> </wideMargins>
  651.         <multipleLines> <false /> </multipleLines>
  652.         <reservedFamily> 0 </reservedFamily>
  653.         <titleWidth>0</titleWidth>
  654.         <icon>0</icon>
  655.         <textAlign>center</textAlign>
  656.         <font>Chicago</font>
  657.         <textSize>12</textSize>
  658.         <textStyle>plain</textStyle>
  659.         <textHeight>16</textHeight>
  660.         <name></name>
  661.         <script></script>
  662.     </part>
  663.     <content>
  664.         <layer>card</layer>
  665.         <id>1</id>
  666.         <text>Environment</text>
  667.     </content>
  668.     <content>
  669.         <layer>background</layer>
  670.         <id>9</id>
  671.         <text>pascal CMErr MyEnvironProc(
  672.                 long refCon, 
  673.                 ConnEnvironRec *environ)
  674. {
  675.   OSErr  error;
  676.   long   a5;
  677.   
  678.   a5 = SetA5(refCon);
  679.   error = CMGetConnEnvirons(
  680.              gConnection, environ);
  681.   (void) SetA5(a5);
  682.   return error;
  683. }
  684. </text>
  685.     </content>
  686.     <name>environment</name>
  687.     <script></script>
  688. </card>
  689.  
  690.  
  691. card_10250.xml
  692. <?xml version="1.0" encoding="utf-8" ?>
  693. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  694. <card>
  695.     <id>10250</id>
  696.     <filler1>0</filler1>
  697.     <cantDelete> <false /> </cantDelete>
  698.     <showPict> <true /> </showPict>
  699.     <dontSearch> <false /> </dontSearch>
  700.     <owner>7555</owner>
  701.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  702.     <part>
  703.         <id>1</id>
  704.         <type>field</type>
  705.         <visible> <true /> </visible>
  706.         <dontWrap> <false /> </dontWrap>
  707.         <dontSearch> <false /> </dontSearch>
  708.         <sharedText> <false /> </sharedText>
  709.         <fixedLineHeight> <false /> </fixedLineHeight>
  710.         <autoTab> <false /> </autoTab>
  711.         <lockText> <true /> </lockText>
  712.         <rect>
  713.             <left>377</left>
  714.             <top>24</top>
  715.             <right>454</right>
  716.             <bottom>41</bottom>
  717.         </rect>
  718.         <style>opaque</style>
  719.         <autoSelect> <false /> </autoSelect>
  720.         <showLines> <false /> </showLines>
  721.         <wideMargins> <false /> </wideMargins>
  722.         <multipleLines> <false /> </multipleLines>
  723.         <reservedFamily> 0 </reservedFamily>
  724.         <titleWidth>0</titleWidth>
  725.         <icon>0</icon>
  726.         <textAlign>center</textAlign>
  727.         <font>Chicago</font>
  728.         <textSize>12</textSize>
  729.         <textStyle>plain</textStyle>
  730.         <textHeight>16</textHeight>
  731.         <name></name>
  732.         <script></script>
  733.     </part>
  734.     <content>
  735.         <layer>card</layer>
  736.         <id>1</id>
  737.         <text>Click Loop</text>
  738.     </content>
  739.     <content>
  740.         <layer>background</layer>
  741.         <id>9</id>
  742.         <text>pascal Boolean    MyClickLoop(long refCon)
  743.     long    a5;
  744.     
  745.     a5 = SetA5(refCon);
  746.  
  747.  /* This is really hard */
  748.  /* Surfer Plus is the only sample available */
  749.  
  750.     (void) SetA5(a5);
  751.     return false;
  752. }
  753. </text>
  754.     </content>
  755.     <name>Click</name>
  756.     <script></script>
  757. </card>
  758.  
  759.  
  760. card_11025.xml
  761. <?xml version="1.0" encoding="utf-8" ?>
  762. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  763. <card>
  764.     <id>11025</id>
  765.     <filler1>0</filler1>
  766.     <cantDelete> <false /> </cantDelete>
  767.     <showPict> <true /> </showPict>
  768.     <dontSearch> <false /> </dontSearch>
  769.     <owner>7555</owner>
  770.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  771.     <part>
  772.         <id>1</id>
  773.         <type>field</type>
  774.         <visible> <true /> </visible>
  775.         <dontWrap> <false /> </dontWrap>
  776.         <dontSearch> <false /> </dontSearch>
  777.         <sharedText> <false /> </sharedText>
  778.         <fixedLineHeight> <false /> </fixedLineHeight>
  779.         <autoTab> <false /> </autoTab>
  780.         <lockText> <true /> </lockText>
  781.         <rect>
  782.             <left>384</left>
  783.             <top>24</top>
  784.             <right>449</right>
  785.             <bottom>41</bottom>
  786.         </rect>
  787.         <style>opaque</style>
  788.         <autoSelect> <false /> </autoSelect>
  789.         <showLines> <false /> </showLines>
  790.         <wideMargins> <false /> </wideMargins>
  791.         <multipleLines> <false /> </multipleLines>
  792.         <reservedFamily> 0 </reservedFamily>
  793.         <titleWidth>0</titleWidth>
  794.         <icon>0</icon>
  795.         <textAlign>center</textAlign>
  796.         <font>Chicago</font>
  797.         <textSize>12</textSize>
  798.         <textStyle>plain</textStyle>
  799.         <textHeight>16</textHeight>
  800.         <name></name>
  801.         <script></script>
  802.     </part>
  803.     <content>
  804.         <layer>card</layer>
  805.         <id>1</id>
  806.         <text>Caching</text>
  807.     </content>
  808.     <content>
  809.         <layer>background</layer>
  810.         <id>9</id>
  811.         <text>pascal long    MyCacheProc(
  812.                 long refCon,
  813.                 TermDataBlock *termData)
  814. {
  815.     long    a5;
  816.     
  817.     a5 = SetA5(refCon);
  818.  
  819.     HLock((*termData).theData);
  820.     BlockMove(
  821.      *(*termData).theData, 
  822.      &gCache[gCacheTop], 
  823.      GetHandleSize((*termData).theData));
  824.     HUnlock((*termData).theData);
  825.  
  826.     ++gCacheTop;
  827.     if (kCacheMax == gCacheTop)
  828.     {
  829.         gCacheTop = kCacheMin;
  830.     }
  831.  
  832.     (void) SetA5(a5);
  833.     return tmNoErr;
  834. }
  835. </text>
  836.     </content>
  837.     <name>Caching</name>
  838.     <script></script>
  839. </card>
  840.  
  841.  
  842. card_10992.xml
  843. <?xml version="1.0" encoding="utf-8" ?>
  844. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  845. <card>
  846.     <id>10992</id>
  847.     <filler1>0</filler1>
  848.     <cantDelete> <false /> </cantDelete>
  849.     <showPict> <true /> </showPict>
  850.     <dontSearch> <false /> </dontSearch>
  851.     <owner>7555</owner>
  852.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  853.     <part>
  854.         <id>1</id>
  855.         <type>field</type>
  856.         <visible> <true /> </visible>
  857.         <dontWrap> <false /> </dontWrap>
  858.         <dontSearch> <false /> </dontSearch>
  859.         <sharedText> <false /> </sharedText>
  860.         <fixedLineHeight> <false /> </fixedLineHeight>
  861.         <autoTab> <false /> </autoTab>
  862.         <lockText> <true /> </lockText>
  863.         <rect>
  864.             <left>368</left>
  865.             <top>24</top>
  866.             <right>475</right>
  867.             <bottom>41</bottom>
  868.         </rect>
  869.         <style>opaque</style>
  870.         <autoSelect> <false /> </autoSelect>
  871.         <showLines> <false /> </showLines>
  872.         <wideMargins> <false /> </wideMargins>
  873.         <multipleLines> <false /> </multipleLines>
  874.         <reservedFamily> 0 </reservedFamily>
  875.         <titleWidth>0</titleWidth>
  876.         <icon>0</icon>
  877.         <textAlign>center</textAlign>
  878.         <font>Chicago</font>
  879.         <textSize>12</textSize>
  880.         <textStyle>plain</textStyle>
  881.         <textHeight>16</textHeight>
  882.         <name></name>
  883.         <script></script>
  884.     </part>
  885.     <content>
  886.         <layer>card</layer>
  887.         <id>1</id>
  888.         <text>Receiving Data</text>
  889.     </content>
  890.     <content>
  891.         <layer>background</layer>
  892.         <id>9</id>
  893.         <text>This is not really a callback made by the Terminal Manager. You have to call it in the event loop.
  894.  
  895. OSErr MyRecvProc()
  896. {
  897.   OSErr            error;
  898.   CMBufferSizes    sizes;
  899.   CMStatFlags      status;  
  900.   Str255           buffer;
  901.   long             tmCount;
  902.   long             cmCount;
  903.   CMFlags          cmFlags;
  904.  
  905.   error = CMStatus(gConnection, &sizes, &status);
  906.   if (noErr == error)
  907.   {
  908.     if (status & cmStatusOpen)
  909.     {
  910.       if (status & cmStatusDataAvail)
  911.       {
  912.         cmCount = min(
  913.                    sizeof(buffer),
  914.                    sizes[cmDataIn]);
  915.         error = CMRead(
  916.                  gConnection, 
  917.                  buffer, 
  918.                  &cmCount, 
  919.                  cmData, 
  920.                  false, 
  921.                  nil, 
  922.                  0, 
  923.                  &cmFlags);
  924.         if (noErr == error)
  925.         {
  926.           tmCount = TMStream(
  927.                       gTerminal, 
  928.                       buffer, 
  929.                       cmCount, 
  930.                       cmFlags);
  931.         }
  932.       }
  933.     }
  934.   }
  935.   return error;
  936. }
  937. </text>
  938.     </content>
  939.     <name>Receiving</name>
  940.     <script></script>
  941. </card>
  942.  
  943.  
  944. card_10533.xml
  945. <?xml version="1.0" encoding="utf-8" ?>
  946. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  947. <card>
  948.     <id>10533</id>
  949.     <filler1>0</filler1>
  950.     <cantDelete> <false /> </cantDelete>
  951.     <showPict> <true /> </showPict>
  952.     <dontSearch> <false /> </dontSearch>
  953.     <owner>7555</owner>
  954.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  955.     <part>
  956.         <id>1</id>
  957.         <type>field</type>
  958.         <visible> <true /> </visible>
  959.         <dontWrap> <false /> </dontWrap>
  960.         <dontSearch> <false /> </dontSearch>
  961.         <sharedText> <false /> </sharedText>
  962.         <fixedLineHeight> <false /> </fixedLineHeight>
  963.         <autoTab> <false /> </autoTab>
  964.         <lockText> <true /> </lockText>
  965.         <rect>
  966.             <left>365</left>
  967.             <top>24</top>
  968.             <right>463</right>
  969.             <bottom>41</bottom>
  970.         </rect>
  971.         <style>opaque</style>
  972.         <autoSelect> <false /> </autoSelect>
  973.         <showLines> <false /> </showLines>
  974.         <wideMargins> <false /> </wideMargins>
  975.         <multipleLines> <false /> </multipleLines>
  976.         <reservedFamily> 0 </reservedFamily>
  977.         <titleWidth>0</titleWidth>
  978.         <icon>0</icon>
  979.         <textAlign>center</textAlign>
  980.         <font>Chicago</font>
  981.         <textSize>12</textSize>
  982.         <textStyle>plain</textStyle>
  983.         <textHeight>16</textHeight>
  984.         <name></name>
  985.         <script></script>
  986.     </part>
  987.     <content>
  988.         <layer>card</layer>
  989.         <id>1</id>
  990.         <text>Sending Data</text>
  991.     </content>
  992.     <content>
  993.         <layer>background</layer>
  994.         <id>9</id>
  995.         <text>pascal long  MySendProc (
  996.                Ptr ptr,
  997.                long size, 
  998.                         long refCon,
  999.                short flags)
  1000. {
  1001.   OSErr  error;
  1002.   long   a5;
  1003.   
  1004.   a5 = SetA5(refCon);
  1005.   
  1006.   error = CMWrite(
  1007.             gConnection, 
  1008.             ptr, 
  1009.             &size, 
  1010.             cmData, 
  1011.             false, 
  1012.             nil, 
  1013.             0, 
  1014.             flags);
  1015.     
  1016.   (void) SetA5(a5);
  1017.   return noErr == error ? size : 0;
  1018. }
  1019. </text>
  1020.     </content>
  1021.     <name>Sending</name>
  1022.     <script></script>
  1023. </card>
  1024.  
  1025.  
  1026. card_7926.xml
  1027. <?xml version="1.0" encoding="utf-8" ?>
  1028. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  1029. <card>
  1030.     <id>7926</id>
  1031.     <filler1>0</filler1>
  1032.     <cantDelete> <false /> </cantDelete>
  1033.     <showPict> <true /> </showPict>
  1034.     <dontSearch> <false /> </dontSearch>
  1035.     <owner>7555</owner>
  1036.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  1037.     <part>
  1038.         <id>1</id>
  1039.         <type>field</type>
  1040.         <visible> <true /> </visible>
  1041.         <dontWrap> <false /> </dontWrap>
  1042.         <dontSearch> <false /> </dontSearch>
  1043.         <sharedText> <false /> </sharedText>
  1044.         <fixedLineHeight> <false /> </fixedLineHeight>
  1045.         <autoTab> <false /> </autoTab>
  1046.         <lockText> <true /> </lockText>
  1047.         <rect>
  1048.             <left>346</left>
  1049.             <top>24</top>
  1050.             <right>479</right>
  1051.             <bottom>41</bottom>
  1052.         </rect>
  1053.         <style>opaque</style>
  1054.         <autoSelect> <false /> </autoSelect>
  1055.         <showLines> <false /> </showLines>
  1056.         <wideMargins> <false /> </wideMargins>
  1057.         <multipleLines> <false /> </multipleLines>
  1058.         <reservedFamily> 0 </reservedFamily>
  1059.         <titleWidth>0</titleWidth>
  1060.         <icon>0</icon>
  1061.         <textAlign>center</textAlign>
  1062.         <font>Chicago</font>
  1063.         <textSize>12</textSize>
  1064.         <textStyle>plain</textStyle>
  1065.         <textHeight>16</textHeight>
  1066.         <name></name>
  1067.         <script></script>
  1068.     </part>
  1069.     <part>
  1070.         <id>2</id>
  1071.         <type>field</type>
  1072.         <visible> <false /> </visible>
  1073.         <dontWrap> <false /> </dontWrap>
  1074.         <dontSearch> <false /> </dontSearch>
  1075.         <sharedText> <false /> </sharedText>
  1076.         <fixedLineHeight> <false /> </fixedLineHeight>
  1077.         <autoTab> <false /> </autoTab>
  1078.         <lockText> <true /> </lockText>
  1079.         <rect>
  1080.             <left>130</left>
  1081.             <top>280</top>
  1082.             <right>576</right>
  1083.             <bottom>352</bottom>
  1084.         </rect>
  1085.         <style>scrolling</style>
  1086.         <autoSelect> <false /> </autoSelect>
  1087.         <showLines> <false /> </showLines>
  1088.         <wideMargins> <false /> </wideMargins>
  1089.         <multipleLines> <false /> </multipleLines>
  1090.         <reservedFamily> 0 </reservedFamily>
  1091.         <titleWidth>0</titleWidth>
  1092.         <icon>0</icon>
  1093.         <textAlign>left</textAlign>
  1094.         <font>Geneva</font>
  1095.         <textSize>9</textSize>
  1096.         <textStyle>plain</textStyle>
  1097.         <textHeight>12</textHeight>
  1098.         <name>the 411 info</name>
  1099.         <script></script>
  1100.     </part>
  1101.     <content>
  1102.         <layer>card</layer>
  1103.         <id>1</id>
  1104.         <text>Terminal Callbacks</text>
  1105.     </content>
  1106.     <content>
  1107.         <layer>card</layer>
  1108.         <id>2</id>
  1109.         <text>√¶KY CMWrite
  1110. Writing data
  1111.  
  1112. Function        CMWrite(hConn: ConnHandle; theBuffer: Ptr; VAR toWrite: 
  1113.                 LONGINT; theChannel: CMChannel; async: BOOLEAN; 
  1114.                 completor: ProcPtr; timeout: LONGINT; flags: CMFlags):
  1115.                 CMErr;
  1116.  
  1117. Description:    CMWrite writes data from a block of memory. Your 
  1118.                 application cannot queue multiple write requests for the
  1119.                 same channel on the same connection. However, your 
  1120.                 application can have both a pending read and a pending 
  1121.                 write on the same channel at the same time. Your 
  1122.                 application can call this routine at interrupt level.
  1123.  
  1124.                 Note:     Your application should not check for an open 
  1125.                 channel prior to writing data. The connection tool might
  1126.                 be interpreting data locally and,therefore, not need an
  1127.                 open connection.
  1128.                 
  1129.                 theBuffer specifies the buffer from which the connection
  1130.                 gets the data to write.
  1131.  
  1132.                 toWrite specifies the number of bytes to be written. If 
  1133.                 your application calls this routine synchronously, the 
  1134.                 connection tool returns the actual number of bytes it 
  1135.                 wrote in toWrite. Your application can call CMStatus to 
  1136.                 see if an asynchronous write is pending. If your 
  1137.                 application calls this routine asynchronously, the 
  1138.                 asyncCount field of the connection record contains the 
  1139.                 actual number of bytes written when the completion 
  1140.                 routine is called.
  1141.  
  1142.                 theChannel specifies the channel on which writing takes
  1143.                 place. Acceptable values are as follows:
  1144.  
  1145.                 CONST
  1146.                     cmData                        =    $00000001;
  1147.                     cmCntl                        =    $00000002;
  1148.                     cmAttn                        =    $00000004;
  1149.  
  1150.                 async specifies whether or not the request is 
  1151.                 asynchronous. If your application makes an asynchronous
  1152.                 request, CMWrite returns cmNoErr immediately.        
  1153.  
  1154.                 completor specifies the completion routine to be called
  1155.                 upon completion of an asynchronous write request. 
  1156.                 Completion routines are discussed in greater detail 
  1157.                 later in this chapter in the section ‚ÄúCompletion 
  1158.                 Routines.‚Äù
  1159.  
  1160.                 timeout specifies a time period, in ticks, within which
  1161.                 the connection tool must complete the write operation.
  1162.                 If it does not finish within thespecified period, a 
  1163.                 timeout error occurs. For no timeout, use ‚Äì1. If your 
  1164.                 application specifies 0, the connection tool writes as
  1165.                 many bytes, up to toWrite bytes, as it can in one write
  1166.                 attempt. Some connection tools ignore this parameter.
  1167.  
  1168.                 flags indicates whether the connection tool should send
  1169.                 an end-of-message indicator. An end-of-message indicator
  1170.                 needs to be supported by the particular communications 
  1171.                 protocol being used; if an end-of-message indicator is
  1172.                 not supported by the connection protocol, your 
  1173.                 application should ignore this field.
  1174.  
  1175.                 CONST
  1176.                     cmFlagsEOM                    =    $0001;
  1177.  
  1178.  
  1179. Result Codes    cmGenericError, cmNoErr, cmRejected, cmFailed, cmTimeout, 
  1180.                 cmNotOpen, cmNoRequestPending, cmNotSupported.
  1181. •
  1182. √¶KY CMStatus
  1183. Getting connection status information
  1184.  
  1185. Function        CMStatus(hConn: ConnHandle; VAR sizes: CMBufferSizes; 
  1186.                 VAR flags: CMStatFlags): CMErr;
  1187.  
  1188. Description:    CMStatus returns a variety of useful status information 
  1189.                 about a connection.    Your application can call this 
  1190.                 routine at interrupt level.
  1191.                 
  1192.                 sizes is a variable of type CMBufferSizes that contains
  1193.                 the number of characters to be read or written on the 
  1194.                 data, control, and attention channels. The indexes of 
  1195.                 the array are as follows:
  1196.  
  1197.                 cmDataIn, cmDataOut, cmCntlIn, cmCntlOut, cmAttnIn, 
  1198.                 cmAttnOut, cmRsrvIn, cmRsrvOut.
  1199.  
  1200.                 flags is a bit field with the following masks:    
  1201.  
  1202.                 CONST
  1203.                                         {tool is opening connection}
  1204.                     cmStatusOpening                =    $00000001;
  1205.                                         {connection is open}
  1206.                     cmStatusOpen                =    $00000002;
  1207.                                         {tool is closing connection}
  1208.                     cmStatusClosing                =    $00000004;
  1209.                                         {data present on data channel}
  1210.                     cmStatusDataAvail            =    $00000008;
  1211.                                         {data present on cntl channel}
  1212.                     cmStatusCntlAvail            =    $00000010;
  1213.                                         {data present on attn channel}
  1214.                     cmStatusAttnAvail            =    $00000020;
  1215.                                         {data read pending}
  1216.                     cmStatusDRPend                =    $00000040;
  1217.                                         {data write pending}
  1218.                     cmStatusDWPend                =    $00000080;
  1219.                                         {cntl read pending}
  1220.                     cmStatusCRPend                =    $00000100;
  1221.                                         {cntl write pending}
  1222.                     cmStatusCWPend                =    $00000200;
  1223.                                         {attn read pending}
  1224.                     cmStatusARPend                =    $00000400;
  1225.                                         {attn write pending}
  1226.                     cmStatusAWPend                =    $00000800;
  1227.                                         {tool is breaking the connection}
  1228.                     cmStatusBreakPending        =    $00001000;
  1229.                                         {tool is ‚Äúlistening‚Äù for data}
  1230.                     cmStatusListenPend            =    $00002000;
  1231.                                         {call waiting for tool to handle}
  1232.                     cmStatusIncomingCallPresent    =    $00004000;
  1233.  
  1234.  
  1235.                 TYPE
  1236.                     CMStatFlags                    =    LONGINT;
  1237.  
  1238.  
  1239. Result Codes    cmGenericError, cmNoErr, cmNotSupported.
  1240. •
  1241. √¶KY CMRead
  1242. Reading data
  1243.  
  1244. Function        CMRead(hConn: ConnHandle; theBuffer: Ptr; VAR toRead: 
  1245.                 LONGINT; theChannel: CMChannel; async: BOOLEAN; 
  1246.                 completor: ProcPtr; timeout: LONGINT; VAR flags: 
  1247.                 CMFlags): CMErr;
  1248.  
  1249. Description:    CMRead reads data into a block of memory. Your 
  1250.                 application cannot queue multiple read requests for the
  1251.                 same channel on the same connection. However, your 
  1252.                 application can have both a pending read and a pending 
  1253.                 write on the same channel at the same time. Your 
  1254.                 application can call this routine at interrupt level.
  1255.                 
  1256.                 Note:     Your application should not check for an open 
  1257.                 channel prior to reading data. The connection tool might
  1258.                 be interpreting data locally and, therefore, not need an
  1259.                 open connection.
  1260.                 
  1261.                 theBuffer specifies the buffer to which the connection 
  1262.                 tool should read data. 
  1263.  
  1264.                 toRead specifies the number of bytes to be read. If your
  1265.                 application calls this routine synchronously, the 
  1266.                 connection tool returns the actual number of bytes it 
  1267.                 read in toRead. Your application can call CMStatus to 
  1268.                 see if an asynchronous read is pending. If your 
  1269.                 application calls this routine asynchronously, the 
  1270.                 asyncCount field of the connection record contains the 
  1271.                 actual number of bytes read when the connection tool 
  1272.                 calls the completion routine.
  1273.  
  1274.                 theChannel specifies the channel on which reading takes
  1275.                 place. Acceptable values are as follows:
  1276.  
  1277.                 CONST
  1278.                     cmData                        =    $00000001;
  1279.                     cmCntl                        =    $00000002;
  1280.                     cmAttn                        =    $00000004;
  1281.  
  1282.                 async specifies whether or not the request is 
  1283.                 asynchronous. If an asynchronous request is made, 
  1284.                 cmNoErr is returned immediately.     
  1285.  
  1286.                 completor specifies the completion routine to be called
  1287.                 upon completion of an asynchronous read request. 
  1288.                 Completion routines are discussed in greater detail 
  1289.                 later in this chapter in the section ‚ÄúCompletion 
  1290.                 Routines.‚Äù 
  1291.  
  1292.                 timeout specifies a time period, in ticks, within which 
  1293.                 the connection tool must complete the read operation. If
  1294.                 it does not finish within the specified time, a timeout 
  1295.                 error occurs. For no timeout, use ‚Äì1. If your 
  1296.                 application specifies 0, the connection tool reads as
  1297.                 many bytes, up to toRead bytes, as it    can in one read 
  1298.                 attempt. Some connection tools ignore this parameter.
  1299.  
  1300.                 flags indicates whether your application received an 
  1301.                 end-of-message indicator. If your application calls this
  1302.                 routine asynchronously, the connection tool returns the
  1303.                 end of message indicator in the reserved0 field of the
  1304.                 connection record when the completion routine is called.
  1305.  
  1306.                 CONST
  1307.                     cmFlagsEOM                    =    $0001;
  1308.  
  1309.  
  1310. Result Codes    cmGenericError, cmNoErr, cmRejected, cmFailed, cmTimeout, 
  1311.                 cmNotOpen, cmNoRequestPending, cmNotSupported.
  1312. •
  1313. √¶KY CMGetConnEnvirons
  1314. Getting the connection environment
  1315.  
  1316. Function        CMGetConnEnvirons (hConn : ConnHandle; VAR theEnvirons :
  1317.                 ConnEnvironRec) : CMErr;
  1318.  
  1319. Description:    CMGetConnEnvirons provides a means for obtaining 
  1320.                 connection environment information.
  1321.                 
  1322.                 CMGetConnEnvirons returns the connection environment 
  1323.                 record in theEnvirons for the connection specified by 
  1324.                 ConnHandle. The connection tool is responsible for 
  1325.                 filling in each field of ConnEnvironRec with either a 
  1326.                 value (if it has a    valid value to supply) or 0.
  1327.                     The structure for version 0 of the connection 
  1328.                 environment record is as follows:
  1329.  
  1330.                 TYPE
  1331.                     ConnEnvironRecPtr            =    ^ConnEnvironRec;
  1332.                     ConnEnvironRec                =    RECORD;
  1333.                         version                    :    INTEGER;
  1334.                                     {version of this data structure}
  1335.                         baudRate                :    LONGINT;
  1336.                                     {data transfer rate}
  1337.                         dataBits                :    INTEGER;
  1338.                                     {number of significant bits per byte}
  1339.                         channels                :    CMChannel;
  1340.                                         {supported channels}
  1341.                         swFlowControl            :    BOOLEAN;
  1342.                                     {if software flow control is in use}
  1343.                         hwFlowControl            :    BOOLEAN;
  1344.                                     {if hardware flow control is in use}
  1345.                         flags                    :    CMFlags;
  1346.                     END;
  1347.     
  1348.                 The version field takes on the following value:    
  1349.         
  1350.                 CONST
  1351.                     curConnEnvRecVers            =    0;
  1352.  
  1353.                 The flags field of the ConnEnvironRec is a bit field 
  1354.                 with the following value:
  1355.  
  1356.                 TYPE
  1357.                     CMFlags                        =    INTEGER;
  1358.  
  1359.                 CONST
  1360.                     cmFlagsEOM                    =    $0001;
  1361.  
  1362.                 Other bits of flags are reserved by Apple Computer, Inc.    
  1363.  
  1364.                 channels is a bit field with the following values:    
  1365.  
  1366.                 TYPE
  1367.                     CMChannel                    =    INTEGER;
  1368.  
  1369.                 CONST
  1370.                     cmData                        =    $00000001;
  1371.                     cmCntl                        =    $00000002;
  1372.                     cmAttn                        =    $00000004;
  1373.  
  1374.                     cmDataClean                    =    $00000100;
  1375.                     cmCntlClean                    =    $00000200;
  1376.                     cmAttnClean                    =    $00000400;
  1377.  
  1378.                 Other bits of channels are reserved by Apple Computer,
  1379.                 Inc.    
  1380.  
  1381.  
  1382. Result Codes    cmGenericError, cmNoErr, cmNotSupported, envVersTooBig
  1383. •
  1384. √¶KY CMBreak
  1385. Sending breaks
  1386.  
  1387. Procedure        CMBreak(hConn: ConnHandle; duration: LONGINT; async: 
  1388.                 BOOLEAN; completor: ProcPtr);
  1389.  
  1390. Description:    CMBreak effects a break operation upon the connection. 
  1391.                 The exact effect of this operation depends upon the tool
  1392.                 in use.
  1393.                 
  1394.                 duration specifies in ticks the length of the break.    
  1395.  
  1396.                 completor specifies the completion routine to be called
  1397.                 upon completion of the break. Completion routines are
  1398.                 called only after asynchronous calls to CMBreak. 
  1399.                 ‚ÄúCompletion Routines,‚Äù later in this chapter, discusses
  1400.                 completion routines in more detail.
  1401. •
  1402. √¶KY TMStream
  1403. Putting data into the terminal
  1404.  
  1405. Function        TMStream(hTerm: TermHandle; theBuffer: Ptr; theLength: 
  1406.                 LONGINT; flags: CMFlags): LONGINT;
  1407.  
  1408. Description:    Your application should use TMStream to give the 
  1409.                 terminal tool data to write into the terminal emulation
  1410.                 buffer.
  1411.  
  1412.                 TMStream returns the number of bytes that it processed.    
  1413.  
  1414.                 theBuffer is the data that is either to be placed in the
  1415.                 terminal emulation buffer or processed by the terminal 
  1416.                 tool. Typically the data theBuffer points to has been 
  1417.                 provided by the connection tool your application is 
  1418.                 using.
  1419. •
  1420. </text>
  1421.     </content>
  1422.     <name>Callbacks</name>
  1423.     <script></script>
  1424. </card>
  1425.  
  1426.  
  1427. card_7414.xml
  1428. <?xml version="1.0" encoding="utf-8" ?>
  1429. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  1430. <card>
  1431.     <id>7414</id>
  1432.     <filler1>0</filler1>
  1433.     <cantDelete> <false /> </cantDelete>
  1434.     <showPict> <true /> </showPict>
  1435.     <dontSearch> <false /> </dontSearch>
  1436.     <owner>5862</owner>
  1437.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  1438.     <part>
  1439.         <id>1</id>
  1440.         <type>field</type>
  1441.         <visible> <true /> </visible>
  1442.         <dontWrap> <false /> </dontWrap>
  1443.         <dontSearch> <false /> </dontSearch>
  1444.         <sharedText> <false /> </sharedText>
  1445.         <fixedLineHeight> <false /> </fixedLineHeight>
  1446.         <autoTab> <false /> </autoTab>
  1447.         <lockText> <true /> </lockText>
  1448.         <rect>
  1449.             <left>336</left>
  1450.             <top>24</top>
  1451.             <right>492</right>
  1452.             <bottom>41</bottom>
  1453.         </rect>
  1454.         <style>opaque</style>
  1455.         <autoSelect> <false /> </autoSelect>
  1456.         <showLines> <false /> </showLines>
  1457.         <wideMargins> <false /> </wideMargins>
  1458.         <multipleLines> <false /> </multipleLines>
  1459.         <reservedFamily> 0 </reservedFamily>
  1460.         <titleWidth>0</titleWidth>
  1461.         <icon>0</icon>
  1462.         <textAlign>center</textAlign>
  1463.         <font>Chicago</font>
  1464.         <textSize>12</textSize>
  1465.         <textStyle>plain</textStyle>
  1466.         <textHeight>16</textHeight>
  1467.         <name></name>
  1468.         <script></script>
  1469.     </part>
  1470.     <content>
  1471.         <layer>background</layer>
  1472.         <id>5</id>
  1473.         <text>unsigned char    flags;
  1474.  
  1475. flags = HGetState((Handle) terminal);
  1476. HLock((Handle) terminal);
  1477. BlockMove(
  1478.         (**terminal).config,
  1479.         (**terminal).oldConfig,
  1480.         GetPtrSize((**terminal).oldConfig));
  1481. HSetState((Handle) terminal, flags);
  1482.  
  1483.  
  1484.  
  1485.  
  1486. </text>
  1487.     </content>
  1488.     <content>
  1489.         <layer>card</layer>
  1490.         <id>1</id>
  1491.         <text>Configuration Records</text>
  1492.     </content>
  1493.     <name>Configuration Records</name>
  1494.     <script></script>
  1495. </card>
  1496.  
  1497.  
  1498. card_6947.xml
  1499. <?xml version="1.0" encoding="utf-8" ?>
  1500. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  1501. <card>
  1502.     <id>6947</id>
  1503.     <filler1>0</filler1>
  1504.     <cantDelete> <false /> </cantDelete>
  1505.     <showPict> <true /> </showPict>
  1506.     <dontSearch> <false /> </dontSearch>
  1507.     <owner>5862</owner>
  1508.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  1509.     <part>
  1510.         <id>1</id>
  1511.         <type>field</type>
  1512.         <visible> <true /> </visible>
  1513.         <dontWrap> <false /> </dontWrap>
  1514.         <dontSearch> <false /> </dontSearch>
  1515.         <sharedText> <false /> </sharedText>
  1516.         <fixedLineHeight> <false /> </fixedLineHeight>
  1517.         <autoTab> <false /> </autoTab>
  1518.         <lockText> <true /> </lockText>
  1519.         <rect>
  1520.             <left>340</left>
  1521.             <top>24</top>
  1522.             <right>492</right>
  1523.             <bottom>41</bottom>
  1524.         </rect>
  1525.         <style>opaque</style>
  1526.         <autoSelect> <false /> </autoSelect>
  1527.         <showLines> <false /> </showLines>
  1528.         <wideMargins> <false /> </wideMargins>
  1529.         <multipleLines> <false /> </multipleLines>
  1530.         <reservedFamily> 0 </reservedFamily>
  1531.         <titleWidth>0</titleWidth>
  1532.         <icon>0</icon>
  1533.         <textAlign>center</textAlign>
  1534.         <font>Chicago</font>
  1535.         <textSize>12</textSize>
  1536.         <textStyle>plain</textStyle>
  1537.         <textHeight>16</textHeight>
  1538.         <name></name>
  1539.         <script></script>
  1540.     </part>
  1541.     <content>
  1542.         <layer>card</layer>
  1543.         <id>1</id>
  1544.         <text>Configuration Strings</text>
  1545.     </content>
  1546.     <content>
  1547.         <layer>background</layer>
  1548.         <id>5</id>
  1549.         <text>OSErr ResetConfig(TermHandle terminal)
  1550. {
  1551.   OSErr        error;
  1552.   Handle       configStr;
  1553.  
  1554.   configStr = Get1Resource('CSTR', kConfigStrID);
  1555.   if (nil == configStr)
  1556.   {
  1557.     error = ResError();
  1558.     if (noErr == error)
  1559.     {
  1560.       error = resNotFound;
  1561.     }
  1562.     return error;
  1563.   }
  1564.   MoveHHi(configStr);
  1565.   HLock(configStr);
  1566.   error = TMSetConfig(terminal, *configStr);
  1567.   HUnlock(configStr);
  1568.   ReleaseResource(configStr);
  1569.   return error;
  1570. }
  1571. </text>
  1572.     </content>
  1573.     <name>Configuration Strings</name>
  1574.     <script></script>
  1575. </card>
  1576.  
  1577.  
  1578. card_6861.xml
  1579. <?xml version="1.0" encoding="utf-8" ?>
  1580. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  1581. <card>
  1582.     <id>6861</id>
  1583.     <filler1>0</filler1>
  1584.     <cantDelete> <false /> </cantDelete>
  1585.     <showPict> <true /> </showPict>
  1586.     <dontSearch> <false /> </dontSearch>
  1587.     <owner>5862</owner>
  1588.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  1589.     <part>
  1590.         <id>1</id>
  1591.         <type>field</type>
  1592.         <visible> <true /> </visible>
  1593.         <dontWrap> <false /> </dontWrap>
  1594.         <dontSearch> <false /> </dontSearch>
  1595.         <sharedText> <false /> </sharedText>
  1596.         <fixedLineHeight> <false /> </fixedLineHeight>
  1597.         <autoTab> <false /> </autoTab>
  1598.         <lockText> <true /> </lockText>
  1599.         <rect>
  1600.             <left>365</left>
  1601.             <top>24</top>
  1602.             <right>466</right>
  1603.             <bottom>41</bottom>
  1604.         </rect>
  1605.         <style>opaque</style>
  1606.         <autoSelect> <false /> </autoSelect>
  1607.         <showLines> <false /> </showLines>
  1608.         <wideMargins> <false /> </wideMargins>
  1609.         <multipleLines> <false /> </multipleLines>
  1610.         <reservedFamily> 0 </reservedFamily>
  1611.         <titleWidth>0</titleWidth>
  1612.         <icon>0</icon>
  1613.         <textAlign>center</textAlign>
  1614.         <font>Chicago</font>
  1615.         <textSize>12</textSize>
  1616.         <textStyle>plain</textStyle>
  1617.         <textHeight>16</textHeight>
  1618.         <name></name>
  1619.         <script></script>
  1620.     </part>
  1621.     <content>
  1622.         <layer>card</layer>
  1623.         <id>1</id>
  1624.         <text>Custom Dialog</text>
  1625.     </content>
  1626.     <content>
  1627.         <layer>background</layer>
  1628.         <id>5</id>
  1629.         <text>TMSetupCleanup
  1630. TMSetupFilter
  1631. TMSetupItem
  1632. TMSetupPostflight
  1633. TMSetupPreFlight
  1634. TMSetupSetup
  1635.  
  1636.  
  1637.  
  1638. </text>
  1639.     </content>
  1640.     <name>Custom</name>
  1641.     <script></script>
  1642. </card>
  1643.  
  1644.  
  1645. card_6449.xml
  1646. <?xml version="1.0" encoding="utf-8" ?>
  1647. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  1648. <card>
  1649.     <id>6449</id>
  1650.     <filler1>0</filler1>
  1651.     <cantDelete> <false /> </cantDelete>
  1652.     <showPict> <true /> </showPict>
  1653.     <dontSearch> <false /> </dontSearch>
  1654.     <owner>5862</owner>
  1655.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  1656.     <part>
  1657.         <id>1</id>
  1658.         <type>field</type>
  1659.         <visible> <true /> </visible>
  1660.         <dontWrap> <false /> </dontWrap>
  1661.         <dontSearch> <false /> </dontSearch>
  1662.         <sharedText> <false /> </sharedText>
  1663.         <fixedLineHeight> <false /> </fixedLineHeight>
  1664.         <autoTab> <false /> </autoTab>
  1665.         <lockText> <true /> </lockText>
  1666.         <rect>
  1667.             <left>365</left>
  1668.             <top>24</top>
  1669.             <right>466</right>
  1670.             <bottom>41</bottom>
  1671.         </rect>
  1672.         <style>opaque</style>
  1673.         <autoSelect> <false /> </autoSelect>
  1674.         <showLines> <false /> </showLines>
  1675.         <wideMargins> <false /> </wideMargins>
  1676.         <multipleLines> <false /> </multipleLines>
  1677.         <reservedFamily> 0 </reservedFamily>
  1678.         <titleWidth>0</titleWidth>
  1679.         <icon>0</icon>
  1680.         <textAlign>center</textAlign>
  1681.         <font>Chicago</font>
  1682.         <textSize>12</textSize>
  1683.         <textStyle>plain</textStyle>
  1684.         <textHeight>16</textHeight>
  1685.         <name></name>
  1686.         <script></script>
  1687.     </part>
  1688.     <content>
  1689.         <layer>card</layer>
  1690.         <id>1</id>
  1691.         <text>Choose Dialog</text>
  1692.     </content>
  1693.     <content>
  1694.         <layer>background</layer>
  1695.         <id>5</id>
  1696.         <text>error = TMChoose(&terminal, where, nil);
  1697. if (chooseDisaster == error)
  1698. {
  1699.     Fail("\pTMChoose", error);
  1700. }
  1701. else
  1702. if (chooseOKMinor == error)
  1703. {
  1704.     UseResFile(gDocFile);
  1705.     error = TerminalSave(terminal);
  1706.     ErrorMessage("\pTerminalSave", error);
  1707. }
  1708. else
  1709. if (chooseOKMajor == error)
  1710. {
  1711.     UseResFile(gDocFile);
  1712.     error = TerminalSave(terminal);
  1713.     ErrorMessage("\pTerminalSave", error);
  1714. }
  1715. </text>
  1716.     </content>
  1717.     <name>Choose</name>
  1718.     <script></script>
  1719. </card>
  1720.  
  1721.  
  1722. card_5945.xml
  1723. <?xml version="1.0" encoding="utf-8" ?>
  1724. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  1725. <card>
  1726.     <id>5945</id>
  1727.     <filler1>0</filler1>
  1728.     <cantDelete> <false /> </cantDelete>
  1729.     <showPict> <true /> </showPict>
  1730.     <dontSearch> <false /> </dontSearch>
  1731.     <owner>5862</owner>
  1732.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  1733.     <part>
  1734.         <id>1</id>
  1735.         <type>field</type>
  1736.         <visible> <false /> </visible>
  1737.         <dontWrap> <false /> </dontWrap>
  1738.         <dontSearch> <false /> </dontSearch>
  1739.         <sharedText> <false /> </sharedText>
  1740.         <fixedLineHeight> <false /> </fixedLineHeight>
  1741.         <autoTab> <false /> </autoTab>
  1742.         <lockText> <true /> </lockText>
  1743.         <rect>
  1744.             <left>130</left>
  1745.             <top>280</top>
  1746.             <right>576</right>
  1747.             <bottom>352</bottom>
  1748.         </rect>
  1749.         <style>scrolling</style>
  1750.         <autoSelect> <false /> </autoSelect>
  1751.         <showLines> <false /> </showLines>
  1752.         <wideMargins> <false /> </wideMargins>
  1753.         <multipleLines> <false /> </multipleLines>
  1754.         <reservedFamily> 0 </reservedFamily>
  1755.         <titleWidth>0</titleWidth>
  1756.         <icon>0</icon>
  1757.         <textAlign>left</textAlign>
  1758.         <font>Geneva</font>
  1759.         <textSize>9</textSize>
  1760.         <textStyle>plain</textStyle>
  1761.         <textHeight>12</textHeight>
  1762.         <name>the 411 info</name>
  1763.         <script></script>
  1764.     </part>
  1765.     <part>
  1766.         <id>2</id>
  1767.         <type>field</type>
  1768.         <visible> <true /> </visible>
  1769.         <dontWrap> <false /> </dontWrap>
  1770.         <dontSearch> <false /> </dontSearch>
  1771.         <sharedText> <false /> </sharedText>
  1772.         <fixedLineHeight> <false /> </fixedLineHeight>
  1773.         <autoTab> <false /> </autoTab>
  1774.         <lockText> <true /> </lockText>
  1775.         <rect>
  1776.             <left>333</left>
  1777.             <top>24</top>
  1778.             <right>495</right>
  1779.             <bottom>41</bottom>
  1780.         </rect>
  1781.         <style>opaque</style>
  1782.         <autoSelect> <false /> </autoSelect>
  1783.         <showLines> <false /> </showLines>
  1784.         <wideMargins> <false /> </wideMargins>
  1785.         <multipleLines> <false /> </multipleLines>
  1786.         <reservedFamily> 0 </reservedFamily>
  1787.         <titleWidth>0</titleWidth>
  1788.         <icon>0</icon>
  1789.         <textAlign>center</textAlign>
  1790.         <font>Chicago</font>
  1791.         <textSize>12</textSize>
  1792.         <textStyle>plain</textStyle>
  1793.         <textHeight>16</textHeight>
  1794.         <name></name>
  1795.         <script></script>
  1796.     </part>
  1797.     <content>
  1798.         <layer>card</layer>
  1799.         <id>2</id>
  1800.         <text>Configuring a Terminal</text>
  1801.     </content>
  1802.     <content>
  1803.         <layer>card</layer>
  1804.         <id>1</id>
  1805.         <text><span class="style15">KY Get1Resource
  1806. Get1Resource is the same as GetResource except that it searches the current resource
  1807. file only.
  1808. </span><span class="style1">‚Ä¢
  1809. </span><span class="style15">√¶KY TMChoose
  1810. Configuring a terminal tool
  1811.  
  1812. Function        TMChoose(VAR hTerm: TermHandle; where: Point; idleProc: 
  1813.                 ProcPtr): INTEGER;
  1814.  
  1815. Description:    An application can configure a terminal tool in one of 
  1816.                 three ways. The easiest and most straightforward way is 
  1817.                 by calling the TMChoose routine. This routine presents 
  1818.                 the user with a dialog box.
  1819.                     The second way an application can configure a 
  1820.                 terminal tool is by presenting the user with a custom 
  1821.                 tool-settings dialog box. This method is much more 
  1822.                 difficult and involves calling six routines. The 
  1823.                 routines are described in the next section, ‚ÄúCustom
  1824.                 Configuration of a Terminal Tool,‚Äù and ‚ÄúThe Custom 
  1825.                 Tool-Settings Dialog Box‚Äù in Appendix C provides 
  1826.                 example code.
  1827.                     The third way your application can configure a
  1828.                 terminal tool is by using the scripting language 
  1829.                 interface, described in ‚ÄúInterfacing with a Scripting 
  1830.                 Language,‚Äù later in this chapter. This method allows 
  1831.                 your application to bypass user interface elements.
  1832.  
  1833.                 where is the point specified in global coordinates, 
  1834.                 where the upper-left corner    of the dialog box should 
  1835.                 appear. It is recommended that your application place
  1836.                 the dialog box as close to the upper-left corner of the 
  1837.                 screen as possible because the size of the dialog box 
  1838.                 varies from tool to tool.
  1839.  
  1840.                 idleProc is a procedure with no parameters that the 
  1841.                 Terminal Manager will automatically call every time    
  1842.                 TMChoose loops through the setup dialog box    filter 
  1843.                 procedure. Pass NIL if your application has no idleProc.         
  1844.  
  1845. TMChoose returns one of the following values:    
  1846.  
  1847. CONST
  1848.     chooseDisaster        =        -2;
  1849.     choose    Failed        =        -1;
  1850.     chooseOKMinor        =        1;
  1851.     chooseOKMajor        =        2;
  1852.     chooseCancel        =        3;
  1853.  
  1854.     chooseDisaster means that the TMChoose operation failed, destroyed 
  1855. the    terminal record, and returned NIL in the terminal handle.     
  1856.     chooseFailed means that the TMChoose operation failed and the 
  1857. terminal record was not changed.
  1858.     chooseOKMinor means that the user clicked OK in the dialog box, but
  1859. did    not change the terminal tool being used.
  1860.     chooseOKMajor means that the user clicked OK in the dialog box and 
  1861. also changed the terminal tool being used. The Terminal Manager then 
  1862. destroys the old terminal handle by calling TMDispose, and returns a new
  1863. terminal handle in hTerm.    
  1864.     chooseCancel means that the user clicked Cancel in the dialog box.
  1865. •
  1866. √¶KY TMSetupCleanup
  1867. Performing clean-up operations
  1868.  
  1869. Procedure        TMSetupCleanup(procID: INTEGER; theConfig: Ptr; count: 
  1870.                 INTEGER; theDialog: DialogPtr; VAR magicCookie: 
  1871.                 LONGINT);
  1872.  
  1873. Description:    TMSetupCleanup disposes of any storage allocated in 
  1874.                 TMSetupPreflight and performs other clean-up operations.
  1875.                 If your application needs to shorten a dialog box, it 
  1876.                 should do so after calling this routine.
  1877.  
  1878.                 procID is the ID for the terminal tool that is being 
  1879.                 configured. Your application should use the same value 
  1880.                 for procID as it passed to TMSetupPreflight.    
  1881.  
  1882.                 theConfig is a pointer to the configuration record for 
  1883.                 the tool being configured.
  1884.  
  1885.                 count is the number of the first item in the dialog item
  1886.                 list appended to the dialog box.
  1887.  
  1888.                 theDialog is the dialog box performing the configuration.    
  1889.  
  1890.                 magicCookie is a pointer to private storage for the 
  1891.                 terminal tool.
  1892. •
  1893. √¶KY TMSetupFilter
  1894. Filtering custom tool-settings dialog box events
  1895.  
  1896. Function        TMSetupFilter(procID: INTEGER; theConfig: Ptr; 
  1897.                 count:INTEGER; theDialog: DialogPtr; VAR theEvent: 
  1898.                 EventRecord; VAR theItem: INTEGER; VAR magicCookie:
  1899.                 LONGINT): BOOLEAN;
  1900.  
  1901. Description:    Your application calls TMSetupFilter as a filter 
  1902.                 procedure before it calls the standard modal dialog box
  1903.                 filter procedure for the custom tool-settings dialog box.
  1904.                 This routine allows terminal tools to filter events in 
  1905.                 the custom tool-settings dialog box.
  1906.  
  1907.                 procID is the ID for the terminal tool that is being
  1908.                 configured. Your application should use the same value 
  1909.                 for procID as it passed to TMSetupPreflight.    
  1910.  
  1911.                 theConfig is the pointer to the configuration record for
  1912.                 the tool being configured.
  1913.  
  1914.                 count is the number of the first item in the dialog item
  1915.                 list appended to the dialog box.
  1916.  
  1917.                 theDialog is the dialog box performing the configuration.    
  1918.  
  1919.                 theEvent is the event record for which filtering is to 
  1920.                 take place.    
  1921.  
  1922.                 theItem can return the item clicked in the dialog box.    
  1923.  
  1924.                 magicCookie is a pointer to private storage for the 
  1925.                 terminal tool.    
  1926.  
  1927.                 If the event passed in was handled, TMSetupFilter 
  1928.                 returns TRUE. Otherwise, FALSE indicates that your 
  1929.                 application should perform standard dialog box filtering.
  1930. •
  1931. √¶KY TMSetupItem
  1932. Processing custom tool-settings dialog box events
  1933.  
  1934. Procedure        TMSetupItem(procID: INTEGER; theConfig: Ptr; count: 
  1935.                 INTEGER; theDialog: DialogPtr; VAR theItem: INTEGER; 
  1936.                 VAR magicCookie: LONGINT);
  1937.  
  1938. Description:    TMSetupItem processes events for controls in the custom 
  1939.                 tool-settings dialog box.
  1940.  
  1941.                 procID is the ID for the terminal tool being configured.
  1942.                 Your application should use the same value for procID as
  1943.                 it passed to TMSetupPreflight.        
  1944.  
  1945.                 theConfig is a pointer to the configuration record for 
  1946.                 the tool being configured.
  1947.  
  1948.                 count is the number of the first item in the dialog item
  1949.                 list appended to the dialog box.
  1950.  
  1951.                 theDialog is the dialog box performing the configuration.    
  1952.  
  1953.                 theItem is the item clicked in the dialog box. This 
  1954.                 value can be modified and sent back.
  1955.  
  1956.                 magicCookie is a pointer to private storage for the 
  1957.                 terminal tool.
  1958. •
  1959. √¶KY TMSetupPostFlight
  1960. Closing the tool file
  1961.  
  1962. Procedure        TMSetupPostflight(procID:INTEGER);
  1963.  
  1964. Description:    TMSetupPostflight closes the tool file if it is not 
  1965.                 being used by any session.    
  1966.  
  1967.                 procID is the ID for the terminal tool that is being 
  1968.                 configured. Your application should use the same value 
  1969.                 for procID as it passed to TMSetupPreflight.
  1970. •
  1971. √¶KY TMSetupPreFlight
  1972. Setting up the custom tool-settings dialog box
  1973.  
  1974. Function        TMSetupPreflight(procID: INTEGER; VAR magicCookie: 
  1975.                 LONGINT): Handle;
  1976.  
  1977. Description:    TMSetupPreflight returns a handle to a dialog item list 
  1978.                 that your application appends to the tool-settings 
  1979.                 dialog box. The handle comes from the terminal tool. 
  1980.                 (The calling application uses AppendDITL, which is 
  1981.                 discussed in Chapter 7.) This handle is not a resource 
  1982.                 handle. Your application is responsible for disposing of
  1983.                 the handle when done with it.
  1984.                     The terminal tool can use TMSetupPreflight to 
  1985.                 allocate a block of private    storage, and to store the 
  1986.                 pointer to that block in magicCookie. magicCookie should
  1987.                 be passed to the other routines that are used to set up
  1988.                 the custom tool-settings dialog box.
  1989.  
  1990.                 procID is the ID for the terminal tool that is being 
  1991.                 configured. Your application should get this value by 
  1992.                 using the TMGetProcID routine, which is    discussed 
  1993.                 earlier in this chapter.
  1994.                 
  1995.                 Note:     The refcon of the custom tool-settings dialog 
  1996.                 box should point to a data structure (an example of 
  1997.                 which is shown next) in which the first two bytes are
  1998.                 the tool procID and the next four bytes are magicCookie.
  1999.                 UserItem routines, for example, may require procID to 
  2000.                 obtain tool resources.    
  2001.  
  2002.  
  2003.                 TYPE
  2004.                     chooseDLOGdata        =    RECORD
  2005.                             procID        :    INTEGER
  2006.                             magicCookie    :    LONGINT
  2007.                 END;
  2008. •
  2009. √¶KY TMSetupSetup
  2010. Setting up the custom tool-settings dialog box items
  2011.  
  2012. Procedure        TMSetupSetup(procID: INTEGER; theConfig: Ptr; count: 
  2013.                 INTEGER; theDialog: DialogPtr; VAR magicCookie: 
  2014.                 LONGINT);
  2015.  
  2016. Description:    TMSetupSetup tells the terminal tool to set up controls
  2017.                 (like radio buttons or check boxes) in the dialog item 
  2018.                 list returned by TMSetupPreflight.    
  2019.  
  2020.                 procID is the ID for the terminal tool being configured.
  2021.                 Your application should use the same value for procID as
  2022.                 it passed to TMSetupPreflight.        
  2023.  
  2024.                 theConfig is a pointer to a configuration record for the
  2025.                 tool being configured.    
  2026.  
  2027.                 count is the number of the first item in the dialog item
  2028.                 list appended to the dialog box.
  2029.  
  2030.                 theDialog is the dialog box in which configuration is 
  2031.                 taking place.    
  2032.                 
  2033.                 magicCookie is a pointer to private storage for the terminal tool.
  2034. •
  2035. √¶KY TMSetConfig
  2036. Setting the configuration with a string
  2037.  
  2038. Function        TMSetConfig(hTerm:¬†TermHandle; thePtr: Ptr): INTEGER;
  2039.  
  2040. Description:    TMSetConfig passes a configuration string to the 
  2041.                 terminal tool.    
  2042.  
  2043.                 TMSetConfig passes a null-terminated, C-style string 
  2044.                 (see the example string    later in this section) to the 
  2045.                 terminal tool for parsing. The string is pointed to
  2046.                 by thePtr and must contain tokens that describe the 
  2047.                 configuration of the terminal record. The string can be
  2048.                 any length.
  2049.  
  2050.                     TMSetConfig ignores items it does not recognize or 
  2051.                 find relevant; such an occurrence causes the terminal 
  2052.                 tool to stop parsing the string and to return the
  2053.                 character position where the error occurred. If the 
  2054.                 terminal tool successfully parses the string, it returns
  2055.                 tmNoErr. If the terminal tool does not successfully    
  2056.                 parse the string, it returns one of the following values:
  2057.                 a number less than ‚Äì1 to indicate an OSErr, ‚Äì1 to 
  2058.                 indicate an unknown error, or a positive number to    
  2059.                 indicate the character position where parsing was 
  2060.                 stopped.
  2061.                     Individual terminal tools are responsible for the 
  2062.                 parsing operation.
  2063.  
  2064. Sample:            A null-terminated, C-style configuration string    
  2065.  
  2066.                 FontSize 9 Width 80 Cursor Underline Online True 
  2067.                 LocalEcho False AutoRepeat True RepeatControls False 
  2068.                 AutoWrap False NewLine False SmoothScroll False 
  2069.                 Transparent False SwapBSDelete False\0
  2070. •
  2071.  
  2072. </span></text>
  2073.     </content>
  2074.     <name>Configuring</name>
  2075.     <script></script>
  2076. </card>
  2077.  
  2078.  
  2079. card_5515.xml
  2080. <?xml version="1.0" encoding="utf-8" ?>
  2081. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  2082. <card>
  2083.     <id>5515</id>
  2084.     <filler1>0</filler1>
  2085.     <cantDelete> <false /> </cantDelete>
  2086.     <showPict> <true /> </showPict>
  2087.     <dontSearch> <false /> </dontSearch>
  2088.     <owner>4094</owner>
  2089.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  2090.     <part>
  2091.         <id>1</id>
  2092.         <type>field</type>
  2093.         <visible> <true /> </visible>
  2094.         <dontWrap> <false /> </dontWrap>
  2095.         <dontSearch> <false /> </dontSearch>
  2096.         <sharedText> <false /> </sharedText>
  2097.         <fixedLineHeight> <false /> </fixedLineHeight>
  2098.         <autoTab> <false /> </autoTab>
  2099.         <lockText> <true /> </lockText>
  2100.         <rect>
  2101.             <left>378</left>
  2102.             <top>24</top>
  2103.             <right>454</right>
  2104.             <bottom>41</bottom>
  2105.         </rect>
  2106.         <style>opaque</style>
  2107.         <autoSelect> <false /> </autoSelect>
  2108.         <showLines> <false /> </showLines>
  2109.         <wideMargins> <false /> </wideMargins>
  2110.         <multipleLines> <false /> </multipleLines>
  2111.         <reservedFamily> 0 </reservedFamily>
  2112.         <titleWidth>0</titleWidth>
  2113.         <icon>0</icon>
  2114.         <textAlign>center</textAlign>
  2115.         <font>Chicago</font>
  2116.         <textSize>12</textSize>
  2117.         <textStyle>plain</textStyle>
  2118.         <textHeight>16</textHeight>
  2119.         <name></name>
  2120.         <script></script>
  2121.     </part>
  2122.     <content>
  2123.         <layer>card</layer>
  2124.         <id>1</id>
  2125.         <text>Disposing</text>
  2126.     </content>
  2127.     <content>
  2128.         <layer>background</layer>
  2129.         <id>5</id>
  2130.         <text>void TerminalDispose(TermHandle *terminal)
  2131. {  
  2132.   if (nil != *terminal)
  2133.   {
  2134.     TMDispose(*terminal);
  2135.     *terminal = nil;
  2136.   }
  2137. }
  2138. </text>
  2139.     </content>
  2140.     <name>Disposing</name>
  2141.     <script></script>
  2142. </card>
  2143.  
  2144.  
  2145. card_15049.xml
  2146. <?xml version="1.0" encoding="utf-8" ?>
  2147. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  2148. <card>
  2149.     <id>15049</id>
  2150.     <filler1>0</filler1>
  2151.     <cantDelete> <false /> </cantDelete>
  2152.     <showPict> <true /> </showPict>
  2153.     <dontSearch> <false /> </dontSearch>
  2154.     <owner>4094</owner>
  2155.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  2156.     <part>
  2157.         <id>1</id>
  2158.         <type>field</type>
  2159.         <visible> <true /> </visible>
  2160.         <dontWrap> <false /> </dontWrap>
  2161.         <dontSearch> <false /> </dontSearch>
  2162.         <sharedText> <false /> </sharedText>
  2163.         <fixedLineHeight> <false /> </fixedLineHeight>
  2164.         <autoTab> <false /> </autoTab>
  2165.         <lockText> <true /> </lockText>
  2166.         <rect>
  2167.             <left>388</left>
  2168.             <top>24</top>
  2169.             <right>448</right>
  2170.             <bottom>41</bottom>
  2171.         </rect>
  2172.         <style>opaque</style>
  2173.         <autoSelect> <false /> </autoSelect>
  2174.         <showLines> <false /> </showLines>
  2175.         <wideMargins> <false /> </wideMargins>
  2176.         <multipleLines> <false /> </multipleLines>
  2177.         <reservedFamily> 0 </reservedFamily>
  2178.         <titleWidth>0</titleWidth>
  2179.         <icon>0</icon>
  2180.         <textAlign>center</textAlign>
  2181.         <font>Chicago</font>
  2182.         <textSize>12</textSize>
  2183.         <textStyle>plain</textStyle>
  2184.         <textHeight>16</textHeight>
  2185.         <name></name>
  2186.         <script></script>
  2187.     </part>
  2188.     <content>
  2189.         <layer>card</layer>
  2190.         <id>1</id>
  2191.         <text>Saving</text>
  2192.     </content>
  2193.     <content>
  2194.         <layer>background</layer>
  2195.         <id>5</id>
  2196.         <text>OSErr  TerminalSave(TermHandle terminal)
  2197. {
  2198.   OSErr          error;
  2199.   Handle         h;
  2200.   short          procID;
  2201.   Str255         toolName;
  2202.   Ptr            configStr;
  2203.   unsigned char  flags;
  2204.  
  2205.   h = Get1Resource('STR ', kTMResourceID);
  2206.   if (nil != h)
  2207.   {
  2208.     RmveResource(h);
  2209.     DisposeHandle(h);
  2210.   }
  2211.  
  2212.   h = Get1Resource('CSTR', kTMResourceID);
  2213.   if (nil != h)
  2214.   {
  2215.     RmveResource(h);
  2216.     DisposeHandle(h);
  2217.   }
  2218.   
  2219.   procID = (**terminal).procID;
  2220.   TMGetToolName(procID, toolName);
  2221.   error = PtrToHand(toolName, &h, sizeof(toolName));
  2222.   if (noErr != error)
  2223.   {
  2224.     return error;
  2225.   }
  2226.   AddResource(h, 'STR ',
  2227.     kTMResourceID, "\pTerminal Tool Name");
  2228.   error = ResError();
  2229.   if (noErr != error)
  2230.   {
  2231.     return error;
  2232.   }
  2233.   ReleaseResource(h);
  2234.  
  2235.   configStr = TMGetConfig(terminal);
  2236.   if (nil == configStr)
  2237.   {
  2238.     error = tmGenericError;
  2239.     return error;
  2240.   }
  2241.   
  2242.   error = PtrToHand(configStr, &h, 
  2243.     GetPtrSize(configStr));
  2244.   DisposPtr(configStr);
  2245.   if (noErr != error)
  2246.   {
  2247.     return error;
  2248.   }
  2249.   AddResource(h, 'CSTR', 
  2250.     kTMResourceID, "\pTerminal Configuration String");
  2251.   error = ResError();
  2252.   if (noErr != error)
  2253.   {
  2254.     return error;
  2255.   }
  2256.   ReleaseResource(h);
  2257.   
  2258.   flags = HGetState((Handle) terminal);
  2259.   HLock((Handle)terminal);
  2260.   BlockMove(
  2261.     (**terminal).config, 
  2262.     (**terminal).oldConfig, 
  2263.     GetPtrSize((**terminal).oldConfig));
  2264.   HSetState((Handle)terminal, flags);
  2265.   
  2266.   return error;
  2267. }</text>
  2268.     </content>
  2269.     <name>saving</name>
  2270.     <script></script>
  2271. </card>
  2272.  
  2273.  
  2274. card_5143.xml
  2275. <?xml version="1.0" encoding="utf-8" ?>
  2276. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  2277. <card>
  2278.     <id>5143</id>
  2279.     <filler1>0</filler1>
  2280.     <cantDelete> <false /> </cantDelete>
  2281.     <showPict> <true /> </showPict>
  2282.     <dontSearch> <false /> </dontSearch>
  2283.     <owner>4094</owner>
  2284.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  2285.     <part>
  2286.         <id>1</id>
  2287.         <type>field</type>
  2288.         <visible> <true /> </visible>
  2289.         <dontWrap> <false /> </dontWrap>
  2290.         <dontSearch> <false /> </dontSearch>
  2291.         <sharedText> <false /> </sharedText>
  2292.         <fixedLineHeight> <false /> </fixedLineHeight>
  2293.         <autoTab> <false /> </autoTab>
  2294.         <lockText> <true /> </lockText>
  2295.         <rect>
  2296.             <left>358</left>
  2297.             <top>24</top>
  2298.             <right>476</right>
  2299.             <bottom>41</bottom>
  2300.         </rect>
  2301.         <style>opaque</style>
  2302.         <autoSelect> <false /> </autoSelect>
  2303.         <showLines> <false /> </showLines>
  2304.         <wideMargins> <false /> </wideMargins>
  2305.         <multipleLines> <false /> </multipleLines>
  2306.         <reservedFamily> 0 </reservedFamily>
  2307.         <titleWidth>0</titleWidth>
  2308.         <icon>0</icon>
  2309.         <textAlign>center</textAlign>
  2310.         <font>Chicago</font>
  2311.         <textSize>12</textSize>
  2312.         <textStyle>plain</textStyle>
  2313.         <textHeight>16</textHeight>
  2314.         <name></name>
  2315.         <script></script>
  2316.     </part>
  2317.     <content>
  2318.         <layer>card</layer>
  2319.         <id>1</id>
  2320.         <text>Document Based</text>
  2321.     </content>
  2322.     <content>
  2323.         <layer>background</layer>
  2324.         <id>5</id>
  2325.         <text>OSErr TerminalOpenDocument(
  2326.             TermHandle *terminal, 
  2327.             WindowPtr window)
  2328. {
  2329.   OSErr      error;
  2330.   Handle     toolName;
  2331.   short      procID;
  2332.   Handle     configStr;
  2333.   Rect       rect;
  2334.   
  2335.   *terminal = nil;
  2336.  
  2337.   toolName = Get1Resource('STR ', kTMResourceID);
  2338.   if (nil == toolName)
  2339.   {
  2340.     error = ResError();
  2341.     if (noErr == error)
  2342.     {
  2343.       error = resNotFound;
  2344.     }
  2345.     return error;
  2346.   }
  2347.   
  2348.   configStr = Get1Resource('CSTR', kTMResourceID);
  2349.   if (nil == configStr)
  2350.   {
  2351.     error = ResError();
  2352.     if (noErr == error)
  2353.     {
  2354.       error = resNotFound;
  2355.     }
  2356.     return error;
  2357.   }
  2358.  
  2359.   MoveHHi(toolName);
  2360.   HLock(toolName);
  2361.   procID = TMGetProcID(*toolName);
  2362.   HUnlock(toolName);
  2363.   ReleaseResource(toolName);
  2364.   if (-1 == procID)
  2365.   {
  2366.     return tmGenericError;
  2367.   }
  2368.   
  2369.   rect = (*window).portRect;
  2370.   rect.right  -= 15;
  2371.   rect.bottom -= 15;
  2372.   
  2373.   *terminal = TMNew(
  2374.             &rect, 
  2375.             &rect, 
  2376.             0, 
  2377.             procID, 
  2378.             window, 
  2379.             (ProcPtr) &MySendProc, 
  2380.             (ProcPtr) &MyCacheProc, 
  2381.             (ProcPtr) &MyBreakProc,
  2382.             (ProcPtr) &MyClickLoop,
  2383.             (ProcPtr) &MyEnvironProc, 
  2384.             (long) SetCurrentA5(), 
  2385.             0
  2386.           );
  2387.   if (nil == *terminal)
  2388.   {
  2389.     error = ResError();
  2390.     if (noErr == error)
  2391.     {
  2392.       error = resNotFound;
  2393.     }
  2394.     return error;
  2395.   }
  2396.   
  2397.   MoveHHi(configStr);
  2398.   HLock(configStr);
  2399.   error = TMSetConfig(*terminal, *configStr);
  2400.   HUnlock(configStr);
  2401.   ReleaseResource(configStr);
  2402.   if (noErr != error)
  2403.   {
  2404.     TMDispose(*terminal);
  2405.     *terminal = nil;
  2406.     return error;
  2407.   }
  2408.  
  2409.   return noErr;
  2410. }
  2411. </text>
  2412.     </content>
  2413.     <name>Document</name>
  2414.     <script></script>
  2415. </card>
  2416.  
  2417.  
  2418. card_5073.xml
  2419. <?xml version="1.0" encoding="utf-8" ?>
  2420. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  2421. <card>
  2422.     <id>5073</id>
  2423.     <filler1>0</filler1>
  2424.     <cantDelete> <false /> </cantDelete>
  2425.     <showPict> <true /> </showPict>
  2426.     <dontSearch> <false /> </dontSearch>
  2427.     <owner>4094</owner>
  2428.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  2429.     <part>
  2430.         <id>1</id>
  2431.         <type>field</type>
  2432.         <visible> <true /> </visible>
  2433.         <dontWrap> <false /> </dontWrap>
  2434.         <dontSearch> <false /> </dontSearch>
  2435.         <sharedText> <false /> </sharedText>
  2436.         <fixedLineHeight> <false /> </fixedLineHeight>
  2437.         <autoTab> <false /> </autoTab>
  2438.         <lockText> <true /> </lockText>
  2439.         <rect>
  2440.             <left>390</left>
  2441.             <top>24</top>
  2442.             <right>451</right>
  2443.             <bottom>41</bottom>
  2444.         </rect>
  2445.         <style>opaque</style>
  2446.         <autoSelect> <false /> </autoSelect>
  2447.         <showLines> <false /> </showLines>
  2448.         <wideMargins> <false /> </wideMargins>
  2449.         <multipleLines> <false /> </multipleLines>
  2450.         <reservedFamily> 0 </reservedFamily>
  2451.         <titleWidth>0</titleWidth>
  2452.         <icon>0</icon>
  2453.         <textAlign>center</textAlign>
  2454.         <font>Chicago</font>
  2455.         <textSize>12</textSize>
  2456.         <textStyle>plain</textStyle>
  2457.         <textHeight>16</textHeight>
  2458.         <name></name>
  2459.         <script></script>
  2460.     </part>
  2461.     <content>
  2462.         <layer>card</layer>
  2463.         <id>1</id>
  2464.         <text>Default</text>
  2465.     </content>
  2466.     <content>
  2467.         <layer>background</layer>
  2468.         <id>5</id>
  2469.         <text>OSErr  TerminalDefault(
  2470.              TermHandle *terminal, 
  2471.              WindowPtr window)
  2472. {
  2473.   OSErr     error;
  2474.   Str255    toolName;
  2475.   short     procID;
  2476.   Rect      rect;
  2477.   
  2478.   *terminal = nil;
  2479.  
  2480.   error = CRMGetIndToolName(
  2481.         classTM, 1, toolName);
  2482.   if (noErr != error)
  2483.   {
  2484.     return error;
  2485.   }
  2486.   
  2487.   procID = TMGetProcID(toolName);
  2488.   if (-1 == procID)
  2489.   {
  2490.     return tmGenericError;
  2491.   }
  2492.  
  2493.   rect = (*window).portRect;
  2494.   rect.right  -= 15;
  2495.   rect.bottom -= 15;
  2496.   
  2497.   *terminal = TMNew(
  2498.             &rect, 
  2499.             &rect, 
  2500.             0, 
  2501.             procID, 
  2502.             window, 
  2503.             (ProcPtr) &MySendProc, 
  2504.             (ProcPtr) &MyCacheProc, 
  2505.             (ProcPtr) &MyBreakProc,
  2506.             (ProcPtr) &MyClickLoop,
  2507.             (ProcPtr) &MyEnvironProc, 
  2508.             (long) SetCurrentA5(), 
  2509.             0
  2510.           );
  2511.   if (nil == *terminal)
  2512.   {
  2513.     error = ResError();
  2514.     if (noErr == error)
  2515.     {
  2516.       error = resNotFound;
  2517.     }
  2518.     return error;
  2519.   }
  2520.   
  2521.   return noErr;
  2522. }
  2523. </text>
  2524.     </content>
  2525.     <name>Default</name>
  2526.     <script></script>
  2527. </card>
  2528.  
  2529.  
  2530. card_4769.xml
  2531. <?xml version="1.0" encoding="utf-8" ?>
  2532. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  2533. <card>
  2534.     <id>4769</id>
  2535.     <filler1>0</filler1>
  2536.     <cantDelete> <false /> </cantDelete>
  2537.     <showPict> <true /> </showPict>
  2538.     <dontSearch> <false /> </dontSearch>
  2539.     <owner>4094</owner>
  2540.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  2541.     <part>
  2542.         <id>1</id>
  2543.         <type>field</type>
  2544.         <visible> <true /> </visible>
  2545.         <dontWrap> <false /> </dontWrap>
  2546.         <dontSearch> <false /> </dontSearch>
  2547.         <sharedText> <false /> </sharedText>
  2548.         <fixedLineHeight> <false /> </fixedLineHeight>
  2549.         <autoTab> <false /> </autoTab>
  2550.         <lockText> <true /> </lockText>
  2551.         <rect>
  2552.             <left>378</left>
  2553.             <top>24</top>
  2554.             <right>454</right>
  2555.             <bottom>41</bottom>
  2556.         </rect>
  2557.         <style>opaque</style>
  2558.         <autoSelect> <false /> </autoSelect>
  2559.         <showLines> <false /> </showLines>
  2560.         <wideMargins> <false /> </wideMargins>
  2561.         <multipleLines> <false /> </multipleLines>
  2562.         <reservedFamily> 0 </reservedFamily>
  2563.         <titleWidth>0</titleWidth>
  2564.         <icon>0</icon>
  2565.         <textAlign>center</textAlign>
  2566.         <font>Chicago</font>
  2567.         <textSize>12</textSize>
  2568.         <textStyle>plain</textStyle>
  2569.         <textHeight>16</textHeight>
  2570.         <name></name>
  2571.         <script></script>
  2572.     </part>
  2573.     <content>
  2574.         <layer>card</layer>
  2575.         <id>1</id>
  2576.         <text>Structure</text>
  2577.     </content>
  2578.     <content>
  2579.         <layer>background</layer>
  2580.         <id>5</id>
  2581.         <text>struct TermRecord {
  2582.     short        procID;
  2583.     TMFlags      flags;
  2584.     TMErr        errCode;
  2585.     long         refCon;
  2586.     long         userData;
  2587.     ProcPtr      defProc;
  2588.     Ptr          config;
  2589.     Ptr          oldConfig;
  2590.     ProcPtr      environsProc;
  2591.     long         reserved1;
  2592.     long         reserved2;
  2593.     Ptr          tmPrivate;
  2594.     ProcPtr      sendProc;
  2595.     ProcPtr      breakProc;
  2596.     ProcPtr      cacheProc;
  2597.     ProcPtr      clikLoop;
  2598.     WindowPtr    owner;
  2599.     Rect         termRect;
  2600.     Rect         viewRect;
  2601.     Rect         visRect;
  2602.     long         lastIdle;
  2603.     TMSelection  selection;
  2604.     TMSelTypes   selType;
  2605.     long         mluField;
  2606. };
  2607. typedef struct TermRecord TermRecord;
  2608. typedef TermRecord **TermHandle, *TermPtr;
  2609.  
  2610.  
  2611. </text>
  2612.     </content>
  2613.     <name>Structure</name>
  2614.     <script></script>
  2615. </card>
  2616.  
  2617.  
  2618. card_4211.xml
  2619. <?xml version="1.0" encoding="utf-8" ?>
  2620. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  2621. <card>
  2622.     <id>4211</id>
  2623.     <filler1>0</filler1>
  2624.     <cantDelete> <false /> </cantDelete>
  2625.     <showPict> <true /> </showPict>
  2626.     <dontSearch> <false /> </dontSearch>
  2627.     <owner>4094</owner>
  2628.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  2629.     <part>
  2630.         <id>6</id>
  2631.         <type>field</type>
  2632.         <visible> <false /> </visible>
  2633.         <dontWrap> <false /> </dontWrap>
  2634.         <dontSearch> <false /> </dontSearch>
  2635.         <sharedText> <false /> </sharedText>
  2636.         <fixedLineHeight> <false /> </fixedLineHeight>
  2637.         <autoTab> <false /> </autoTab>
  2638.         <lockText> <true /> </lockText>
  2639.         <rect>
  2640.             <left>130</left>
  2641.             <top>280</top>
  2642.             <right>576</right>
  2643.             <bottom>352</bottom>
  2644.         </rect>
  2645.         <style>scrolling</style>
  2646.         <autoSelect> <false /> </autoSelect>
  2647.         <showLines> <false /> </showLines>
  2648.         <wideMargins> <false /> </wideMargins>
  2649.         <multipleLines> <false /> </multipleLines>
  2650.         <reservedFamily> 0 </reservedFamily>
  2651.         <titleWidth>0</titleWidth>
  2652.         <icon>0</icon>
  2653.         <textAlign>left</textAlign>
  2654.         <font>Geneva</font>
  2655.         <textSize>9</textSize>
  2656.         <textStyle>plain</textStyle>
  2657.         <textHeight>12</textHeight>
  2658.         <name>the 411 info</name>
  2659.         <script></script>
  2660.     </part>
  2661.     <part>
  2662.         <id>7</id>
  2663.         <type>field</type>
  2664.         <visible> <true /> </visible>
  2665.         <dontWrap> <false /> </dontWrap>
  2666.         <dontSearch> <false /> </dontSearch>
  2667.         <sharedText> <false /> </sharedText>
  2668.         <fixedLineHeight> <false /> </fixedLineHeight>
  2669.         <autoTab> <false /> </autoTab>
  2670.         <lockText> <true /> </lockText>
  2671.         <rect>
  2672.             <left>357</left>
  2673.             <top>24</top>
  2674.             <right>475</right>
  2675.             <bottom>41</bottom>
  2676.         </rect>
  2677.         <style>opaque</style>
  2678.         <autoSelect> <false /> </autoSelect>
  2679.         <showLines> <false /> </showLines>
  2680.         <wideMargins> <false /> </wideMargins>
  2681.         <multipleLines> <false /> </multipleLines>
  2682.         <reservedFamily> 0 </reservedFamily>
  2683.         <titleWidth>0</titleWidth>
  2684.         <icon>0</icon>
  2685.         <textAlign>center</textAlign>
  2686.         <font>Chicago</font>
  2687.         <textSize>12</textSize>
  2688.         <textStyle>plain</textStyle>
  2689.         <textHeight>16</textHeight>
  2690.         <name></name>
  2691.         <script></script>
  2692.     </part>
  2693.     <content>
  2694.         <layer>background</layer>
  2695.         <id>5</id>
  2696.         <text>
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714. </text>
  2715.     </content>
  2716.     <content>
  2717.         <layer>card</layer>
  2718.         <id>7</id>
  2719.         <text>Terminal Record</text>
  2720.     </content>
  2721.     <content>
  2722.         <layer>card</layer>
  2723.         <id>6</id>
  2724.         <text><span class="style15">KY CRMGetIndToolName
  2725. Getting the name of a tool
  2726.  
  2727. Function        CRMGetIndToolName(bundleType: OSType; index: INTEGER;
  2728.                     VAR toolName: Str255): OSErr;
  2729.  
  2730. Description:    CRMGetIndToolName returns the name of a tool in toolName.
  2731.  
  2732.                 The appropriate values for bundleType are as follows:     
  2733.  
  2734.                 CONST
  2735.                     ClassCM         =        'cbnd';
  2736.                     ClassFT         =        'fbnd';
  2737.                     ClassTM            =        'tbnd';
  2738.  
  2739.                 index specifies  which occurrence of a particular type of
  2740.                 tool to return. For example, if index is 2, the 
  2741.                 Communications Resource Manager returns the    name of the 
  2742.                 second tool of a particular type in toolName. If the 
  2743.                 Communications Resource Manager cannot find a tool that 
  2744.                 matches the specified parameters, an empty string is 
  2745.                 returned in toolName.
  2746. •
  2747. √¶KY Get1Resource
  2748. Get1Resource is the same as GetResource except that it searches the current resource
  2749. file only.
  2750. </span><span class="style1">‚Ä¢
  2751. </span><span class="style15">√¶KY TMGetProcID
  2752. Getting current procID information
  2753.  
  2754. Function        TMGetProcID(name: Str255): INTEGER;
  2755.  
  2756. Description:    Your application should call TMGetProcID just before 
  2757.                 creating a new terminal record, to find out the procID 
  2758.                 of a tool.    
  2759.  
  2760.                 name specifies a terminal tool. If a terminal tool is 
  2761.                 available with the specified name, its procID is 
  2762.                 returned. If name references a nonexistent terminal 
  2763.                 tool, TMGetProcID returns ‚Äì1.
  2764. •
  2765. √¶KY TMNew
  2766. Creating a terminal record
  2767.  
  2768. Function        TMNew(termRect: Rect; viewRect: Rect; flags: TMFlags; 
  2769.                 procID: INTEGER; owner: WindowPtr; sendProc: ProcPtr; 
  2770.                 cacheProc: ProcPtr; breakProc: ProcPtr; clikLoop: 
  2771.                 ProcPtr; environsProc: ProcPtr; refCon: LONGINT; 
  2772.                 userData: LONGINT): TermHandle;
  2773.  
  2774. Description:    Once the Terminal Manager has been initialized, your 
  2775.                 application needs to call TMNew to create a terminal 
  2776.                 record to describe the terminal emulation that is to 
  2777.                 take place. TMNew creates a new terminal record, fills 
  2778.                 in the fields it can, based on the parameters that were 
  2779.                 passed to it, and returns a handle to the new record in 
  2780.                 TermHandle. TMNew automatically makes two calls to 
  2781.                 TMDefault (which is described later in this chapter) to
  2782.                 fill in config and oldConfig. The Terminal    Manager then
  2783.                 loads the terminal tool‚Äôs main definition procedure, 
  2784.                 moves it high in the current heap, and locks it. If an
  2785.                 error occurs that prevents a new terminal record from
  2786.                 being created (for example, running out of memory),
  2787.                 TMNew passes back NIL in TermHandle.            
  2788.                     Your application must set the current port to the 
  2789.                 terminal window before it calls    TMNew.    
  2790.  
  2791.                 termRect is a rectangle in local coordinates that 
  2792.                 represents the boundaries of the terminal emulation 
  2793.                 region. Your application initially sets this value by 
  2794.                 passing it as a parameter to TMNew.    viewRect is a subset
  2795.                 of    termRect, which the terminal tool can actually write
  2796.                 into. Your application initially sets this value by
  2797.                 passing it as a parameter to TMNew, but the terminal 
  2798.                 tool may resize it.    
  2799.  
  2800.     flags is a bit field with the following masks:    
  2801.  
  2802.     CONST
  2803.         tmInvisible            =        $00000001;
  2804.         tmSaveBeforeClear    =        $00000002;
  2805.         tmNoMenus            =        $00000004;
  2806.         tmAutoScroll        =        $00000008;
  2807.  
  2808.         flags represents a request from your application for a level of 
  2809.     service.    
  2810.         Apple Computer, Inc. has reserved the bits of flags that are not
  2811.     shown in this document. Do not use them, or your code may not 
  2812.     work in the future.
  2813.         If your application sets tmInvisible, the Terminal Manager 
  2814.     maintains a    terminal emulation but does not display it. Your 
  2815.     application can use the terminal emulation and cache regions to 
  2816.     create some other presentation service instead of a terminal 
  2817.     emulation.
  2818.         If your application sets tmSaveBeforeClear, the terminal tool 
  2819.     attempts to    cache the entire terminal emulation region in response 
  2820.     to any clear-screen operation. Clear-screen operations are generated
  2821.     from either a user‚Äôs request, a clear-screen character sequence, or 
  2822.     a terminal-reset character sequence.
  2823.         If your application sets tmNoMenus, the terminal tool does not 
  2824.     display    any custom menus.
  2825.  
  2826.         If your application sets tmAutoScroll, the terminal tool 
  2827.     automatically scrolls the terminal emulation window (if necessary) 
  2828.     while the user highlights a selection.
  2829.  
  2830.     procID values are dynamically assigned by the Terminal Manager to 
  2831.     tools at run time. Applications should not store procID values in 
  2832.     ‚Äúsettings‚Äù files. Instead, they should store tool names, which can
  2833.     be converted to procID values with TMGetProcID. Use the ID that 
  2834.     TMGetProcID returns for procID.                
  2835.  
  2836.     owner is a pointer to the window in which your application is
  2837.     displaying the terminal emulation. If tmInvisible is FALSE, owner 
  2838.     should be a grafPort that the terminal tool has control over.
  2839.  
  2840.     sendProc is a pointer to a routine the terminal tool calls when it
  2841.     needs to send data on a connection. A more detailed description of 
  2842.     sendProc appears later in this chapter, in the section ‚ÄúRoutines 
  2843.     That Must Be in Your Application.‚Äù 
  2844.     
  2845.     cacheProc is a pointer to a routine in your application that saves 
  2846.     lines that scroll off the top of the terminal emulation region. This
  2847.     routine also saves the terminal screen before a clear-screen 
  2848.     operation (if TMSaveBeforeClear is set). If your application does 
  2849.     not have a cacheProc, specify NIL in this field. A more detailed 
  2850.     description of cacheProc appears later in this chapter in the 
  2851.     section ‚ÄúRoutines That Must Be in Your Application.‚Äù
  2852.  
  2853.     breakProc is a pointer to a routine in your application that 
  2854.     performs some sort of break operation. The effect the break has 
  2855.     depends upon the terminal emulation tool that your application is 
  2856.     using. A more detailed description of breakProc appears later in 
  2857.     this chapter in the section ‚ÄúRoutines That Must Be in Your 
  2858.     Application.‚Äù
  2859.  
  2860.     clikLoop is a pointer to a routine in your application that is 
  2861.     called when the    mouse button is held down. The terminal tool calls 
  2862.     the click loop repeatedly when users are clicking and dragging the 
  2863.     mouse. A more detailed description of clikLoop appears later in this
  2864.     chapter, in the section ‚ÄúRoutines That Must Be in Your Application.‚Äù
  2865.     Specify NIL in this field if your application has no clikLoop 
  2866.     procedure.
  2867.  
  2868.     environsProc is a pointer to a routine that the terminal tool calls 
  2869.     when it    requires information about the connection. See ‚ÄúConnection 
  2870.     Manager Routines‚Äù in Chapter 3 for information about the 
  2871.     CMGetConnEnvirons routine.    
  2872.  
  2873.     userData and refCon are fields your application can use.
  2874. •
  2875. √¶KY TMSetConfig
  2876. Setting the configuration with a string
  2877.  
  2878. Function        TMSetConfig(hTerm:¬†TermHandle; thePtr: Ptr): INTEGER;
  2879.  
  2880. Description:    TMSetConfig passes a configuration string to the 
  2881.                 terminal tool.    
  2882.  
  2883.                 TMSetConfig passes a null-terminated, C-style string 
  2884.                 (see the example string    later in this section) to the 
  2885.                 terminal tool for parsing. The string is pointed to
  2886.                 by thePtr and must contain tokens that describe the 
  2887.                 configuration of the terminal record. The string can be
  2888.                 any length.
  2889.  
  2890.                     TMSetConfig ignores items it does not recognize or 
  2891.                 find relevant; such an occurrence causes the terminal 
  2892.                 tool to stop parsing the string and to return the
  2893.                 character position where the error occurred. If the 
  2894.                 terminal tool successfully parses the string, it returns
  2895.                 tmNoErr. If the terminal tool does not successfully    
  2896.                 parse the string, it returns one of the following values:
  2897.                 a number less than ‚Äì1 to indicate an OSErr, ‚Äì1 to 
  2898.                 indicate an unknown error, or a positive number to    
  2899.                 indicate the character position where parsing was 
  2900.                 stopped.
  2901.                     Individual terminal tools are responsible for the 
  2902.                 parsing operation.
  2903.  
  2904. Sample:            A null-terminated, C-style configuration string    
  2905.  
  2906.                 FontSize 9 Width 80 Cursor Underline Online True 
  2907.                 LocalEcho False AutoRepeat True RepeatControls False 
  2908.                 AutoWrap False NewLine False SmoothScroll False 
  2909.                 Transparent False SwapBSDelete False\0
  2910. •
  2911. √¶KY TMDispose
  2912. Disposing of a terminal record
  2913.  
  2914. Procedure        TMDispose(hTerm: TermHandle);
  2915.  
  2916.                 Important:    Your application must call TMDispose before 
  2917.                 disposing of the terminal emulation window with 
  2918.                 DisposeWindow. Since DisposeWindow clears all controls 
  2919.                 in the control list, a subsequent call to TMDispose may 
  2920.                 cause problems.      
  2921.  
  2922. Description:    TMDispose disposes of the terminal record and all 
  2923.                 associated data structures and controls.
  2924. •
  2925. √¶KY TMGetToolName
  2926. Getting the name of a tool
  2927.  
  2928. Procedure        TMGetToolName(procID: INTEGER; VAR name: Str255);
  2929.  
  2930. Description:    TMGetToolName returns in name the name of the tool 
  2931.                 specified by procID.            
  2932.  
  2933.                 If procID references a terminal tool that does not 
  2934.                 exist, the Terminal    Manager sets name to an empty 
  2935.                 string.
  2936. •
  2937. √¶KY TMGetConfig
  2938. Getting the configuration string
  2939.  
  2940. Function        TMGetConfig(hTerm:¬†TermHandle): Ptr;
  2941.  
  2942. Description:    TMGetConfig gets a configuration string from the 
  2943.                 terminal tool.    
  2944.  
  2945.                 TMGetConfig returns a null-terminated, C-style string 
  2946.                 from the terminal tool containing tokens that fully 
  2947.                 describe the configuration of the terminal record.
  2948.                 For an example, see the description of the next routine.
  2949.                 If an error occurs, TMGetConfig returns NIL.        
  2950.                     It is the responsibility of your application to
  2951.                 dispose of Ptr.
  2952. •
  2953. √¶KY procID
  2954. procID is the terminal tool ID. This value is dynamically assigned by
  2955. the Terminal Manager when your application calls TMGetProcID.    
  2956. •
  2957. √¶KY flags
  2958. flags is a bit field with the following masks:    
  2959.  
  2960.                 CONST
  2961.                         tmInvisible            =        $00000001;
  2962.                         tmSaveBeforeClear    =        $00000002;
  2963.                         tmNoMenus            =        $00000004;
  2964.                         tmAutoScroll        =        $00000008;
  2965.             
  2966.                 TYPE
  2967.                         TMFlags                :        LONGINT;
  2968.  
  2969.                     If your application sets tmInvisible, the Terminal
  2970.                 Manager maintains a terminal emulation but does not 
  2971.                 display it. Your application can use the terminal 
  2972.                 emulation and cache region to create some other 
  2973.                 presentation service, instead of a terminal emulation.
  2974.                     If your application sets tmSaveBeforeClear, the 
  2975.                 terminal tool will try to cache the entire terminal 
  2976.                 emulation region in response to any clear-screen 
  2977.                 operation. Clear-screen operations are generated from a 
  2978.                 user‚Äôs request, a clear-screen character sequence, or a
  2979.                 terminal-reset character sequence.
  2980.                     If your application sets tmNoMenus, the terminal
  2981.                 tool will not put up any custom menus.
  2982.                     If your application sets tmAutoScroll, the terminal
  2983.                 tool will automatically scroll the terminal emulation
  2984.                 window (if necessary) while the user is highlighting a 
  2985.                 selection.
  2986. •
  2987. √¶KY errCode
  2988. The Terminal Manager does not use errCode; it is included in this 
  2989. version (version 1.0) of the terminal record for reasons of historical 
  2990. preservation. Your application must not use this field.
  2991. •
  2992. √¶KY refCon
  2993. refCon is a LONGINT that your application can use.        
  2994. •
  2995. √¶KY userData
  2996. userData is a LONGINT that your application can use.        
  2997. •
  2998. √¶KY defProc
  2999. defProc is a pointer to the main code resource of the terminal tool 
  3000. that will implement the specifics of the terminal emulation. The 
  3001. terminal tool‚Äôs main code resource is of type 'tdef'.
  3002. •
  3003. √¶KY config
  3004. config is a pointer to a data block that is private to the terminal 
  3005. tool. 
  3006.     Your application can store the contents of config to save the state 
  3007. of a terminal in a document. The structure, size, and contents of the 
  3008. configuration record are set by the tool. Your application can determine
  3009. the size of the configuration record by calling GetPtrSize, overwrite 
  3010. its contents using BlockMove, and validate the contents with TMValidate.    
  3011.     Your application can use TMGetConfig and TMSetConfig to manipulate 
  3012. fields in this record. For details, read ‚ÄúInterfacing with a Scripting
  3013. Language,‚Äù later in this chapter. Your application can save the state of
  3014. the terminal record by saving the string TMGetConfig returns. Also, your
  3015. application can restore the configuration of the terminal record by 
  3016. passing a saved string to TMSetConfig.    
  3017. You can find a description of config from a terminal tool perspective in
  3018. Chapter 8.    
  3019. •
  3020. √¶KY oldConfig
  3021. oldConfig is a pointer to a data block that is private to the 
  3022. terminal tool and contains the most recently saved version of config.
  3023. Your application is responsible for setting    oldConfig when the user 
  3024. saves a session document.
  3025. •
  3026. √¶KY environsProc
  3027. environsProc is a pointer to a routine in your application that the 
  3028. terminal tool can call to obtain a record describing the connection 
  3029. environment. A more detailed description of environsProc appears later 
  3030. in this chapter in ‚ÄúRoutines That Must Be in Your Application.‚Äù
  3031. •
  3032. √¶KY reserved2
  3033. reserved1 and reserved2 are reserved for the Terminal Manager. Your 
  3034. application    must not use this field.
  3035. •
  3036. √¶KY reserved1
  3037. reserved1 and reserved2 are reserved for the Terminal Manager. Your 
  3038. application    must not use this field.
  3039. •
  3040. √¶KY tmPrivate
  3041. tmPrivate is a pointer to a data block that is private to the 
  3042. terminal tool. Your    application must not use this field.
  3043. •
  3044. √¶KY sendProc
  3045. sendProc is a pointer to a routine your application calls when it
  3046. needs to send data to another application. A more detailed description 
  3047. of sendProc appears later in this chapter in ‚ÄúRoutines That Must Be in 
  3048. Your Application.‚Äù
  3049. •
  3050. √¶KY breakProc
  3051. breakProc is a pointer to a routine in your application that performs
  3052. a break    operation. The effect the break has depends on the terminal 
  3053. emulation being used. A more detailed description of breakProc appears
  3054. later in this chapter in ‚ÄúRoutines That Must Be in Your Application.‚Äù
  3055. •
  3056. √¶KY cacheProc
  3057. cacheProc is a pointer to a routine in your application that saves 
  3058. lines that scroll off the top of the terminal emulation region. The 
  3059. terminal tool also uses this routine to save the terminal screen before 
  3060. a clear-screen operation (if the TMSaveBeforeClear bit is set in the 
  3061. flags field of the terminal record). A more detailed description of    
  3062. cacheProc appears later in this chapter in ‚ÄúRoutines That Must Be in 
  3063. Your Application.‚Äù
  3064. •
  3065. √¶KY clikLoop
  3066. clikLoop is a pointer to a routine in your application that handles 
  3067. mouse clicks. The terminal tool calls the click loop repeatedly when the
  3068. user is clicking or dragging an object. A more detailed description of 
  3069. this routine appears later in this chapter in ‚ÄúRoutines That Must Be in Your Application.‚Äù
  3070. •
  3071. √¶KY owner
  3072. owner is a pointer to the grafPort in which your application displays
  3073. the terminal emulation.
  3074. •
  3075. √¶KY termRect
  3076. termRect is the portRect of the current window, minus the scroll 
  3077. bars. This portRect    represent the boundaries of the terminal emulation 
  3078. region. Figure 4-3 shows how termRects relates to the terminal emulation
  3079. window.     
  3080.  
  3081.                 Note:     Your application can display the terminal 
  3082.                 emulation region in an area that is smaller than 
  3083.                 termRect, but it must not display the combination of the
  3084.                 cache region and terminal emulation region in an area 
  3085.                 larger than termRect.    
  3086. •
  3087. √¶KY viewRect
  3088. viewRect is a rectangle, measured in pixels, that represents the 
  3089. screen of an actual    terminal. For some terminal types‚Äîfor instance, 
  3090. Teletype or VT102‚Ñ¢‚Äî    has    viewRect 24 lines and 80 columns. The dimensions
  3091. of viewRect remain constant except when    elements such as a tab ruler or
  3092. status bar appear in the terminal emulation window, or when the size of 
  3093. the display font changes. The relationship of termRect to viewRect        
  3094. determines how much of viewRect is visible in the terminal emulation 
  3095. window.    
  3096. •
  3097. √¶KY visRect
  3098. visRect is a rectangle that represents the currently visible rows 
  3099. and columns in the terminal emulation region (for text terminals). 
  3100. Numbering of rows and columns begins with the number 1.
  3101.     visRect.top is the top visible line, and visRect.left is the 
  3102. leftmost visible column in the terminal emulation region. visRect.bottom
  3103. is the bottom visible line,    and    visRect.right is the rightmost visible 
  3104. column in the terminal region. These values are used by the application
  3105. to determine scroll-bar values.
  3106. •
  3107. √¶KY lastIdle
  3108. lastIdle is the last time, in ticks, that the idle procedure was 
  3109. called for the specified terminal record.
  3110. •
  3111. √¶KY selection
  3112. selection is a data structure that describes the extent of the 
  3113. current selection in the terminal emulation window. Since selection can 
  3114. describe either a rectangle or a region, it describes the selection in 
  3115. one of two kinds of data structures: a Rect    or a RgnHandle. The format 
  3116. of the TMSelection data structure is as follows:        
  3117.  
  3118. TYPE
  3119.         TMSelection                    =        RECORD
  3120.                 CASE INTEGER OF
  3121.                 1:    (
  3122.                     selRect            :        Rect;
  3123.                     );
  3124.                 2:    (
  3125.                     selRgnHandle    :        RgnHandle;
  3126.                     filler            :            LONGINT;
  3127.                     );
  3128.                 END;
  3129.                 
  3130.     selRect is of type Rect and describes the rectangle that has been 
  3131. selected. On a text    terminal, it contains the row/column pairs, with 
  3132. counting beginning at 1. On a graphics terminal, it contains pixel 
  3133. coordinates, with (1,1) being the topLeft corner of the    terminal region.
  3134.     On a graphics terminal, if the selection is a MacPaint-style lasso,
  3135. selection is a selRgnHandle that represents the selection region.
  3136. •
  3137. √¶KY selType
  3138. selType is a field that further describes a selection; it indicates
  3139. the highlighting mode that is used to show the selection. Valid values
  3140. are as follows:
  3141.  
  3142. CONST
  3143.         selTextNormal            =        $0001;
  3144.         selTextBoxed            =        $0002;
  3145.         selGraphicsMarquee        =        $0004;
  3146.         selGraphicsLasso        =        $0008;
  3147.  
  3148. TYPE
  3149.  
  3150.  
  3151.         TMSelTypes                =        INTEGER;
  3152.  
  3153. selGraphicsMarquee is a standard rectangular MacPaint-style marquee.    
  3154. selGraphicsLasso is a standard MacPaint-style lasso. Your application 
  3155. uses these types of highlighting with graphics terminals.
  3156. •
  3157. √¶KY mluField
  3158. mluField is a LONGINT that terminal tools use. Your application does
  3159. not need to be concerned with this field.
  3160. •
  3161. </span></text>
  3162.     </content>
  3163.     <name>terminal</name>
  3164.     <script></script>
  3165. </card>
  3166.  
  3167.  
  3168. card_14809.xml
  3169. <?xml version="1.0" encoding="utf-8" ?>
  3170. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  3171. <card>
  3172.     <id>14809</id>
  3173.     <filler1>0</filler1>
  3174.     <cantDelete> <false /> </cantDelete>
  3175.     <showPict> <true /> </showPict>
  3176.     <dontSearch> <false /> </dontSearch>
  3177.     <owner>2117</owner>
  3178.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  3179.     <part>
  3180.         <id>1</id>
  3181.         <type>field</type>
  3182.         <visible> <true /> </visible>
  3183.         <dontWrap> <false /> </dontWrap>
  3184.         <dontSearch> <false /> </dontSearch>
  3185.         <sharedText> <false /> </sharedText>
  3186.         <fixedLineHeight> <false /> </fixedLineHeight>
  3187.         <autoTab> <false /> </autoTab>
  3188.         <lockText> <true /> </lockText>
  3189.         <rect>
  3190.             <left>387</left>
  3191.             <top>24</top>
  3192.             <right>452</right>
  3193.             <bottom>41</bottom>
  3194.         </rect>
  3195.         <style>opaque</style>
  3196.         <autoSelect> <false /> </autoSelect>
  3197.         <showLines> <false /> </showLines>
  3198.         <wideMargins> <false /> </wideMargins>
  3199.         <multipleLines> <false /> </multipleLines>
  3200.         <reservedFamily> 0 </reservedFamily>
  3201.         <titleWidth>0</titleWidth>
  3202.         <icon>0</icon>
  3203.         <textAlign>center</textAlign>
  3204.         <font>Chicago</font>
  3205.         <textSize>12</textSize>
  3206.         <textStyle>plain</textStyle>
  3207.         <textHeight>16</textHeight>
  3208.         <name></name>
  3209.         <script></script>
  3210.     </part>
  3211.     <content>
  3212.         <layer>card</layer>
  3213.         <id>1</id>
  3214.         <text>Init Mgr</text>
  3215.     </content>
  3216.     <content>
  3217.         <layer>background</layer>
  3218.         <id>7</id>
  3219.         <text>
  3220. OSErr    error;
  3221.  
  3222. error = InitTM();
  3223.  
  3224. </text>
  3225.     </content>
  3226.     <name>Init Mgr</name>
  3227.     <script></script>
  3228. </card>
  3229.  
  3230.  
  3231. card_14493.xml
  3232. <?xml version="1.0" encoding="utf-8" ?>
  3233. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  3234. <card>
  3235.     <id>14493</id>
  3236.     <filler1>0</filler1>
  3237.     <cantDelete> <false /> </cantDelete>
  3238.     <showPict> <true /> </showPict>
  3239.     <dontSearch> <false /> </dontSearch>
  3240.     <owner>2117</owner>
  3241.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  3242.     <part>
  3243.         <id>1</id>
  3244.         <type>field</type>
  3245.         <visible> <true /> </visible>
  3246.         <dontWrap> <false /> </dontWrap>
  3247.         <dontSearch> <false /> </dontSearch>
  3248.         <sharedText> <false /> </sharedText>
  3249.         <fixedLineHeight> <false /> </fixedLineHeight>
  3250.         <autoTab> <false /> </autoTab>
  3251.         <lockText> <true /> </lockText>
  3252.         <rect>
  3253.             <left>387</left>
  3254.             <top>24</top>
  3255.             <right>450</right>
  3256.             <bottom>41</bottom>
  3257.         </rect>
  3258.         <style>opaque</style>
  3259.         <autoSelect> <false /> </autoSelect>
  3260.         <showLines> <false /> </showLines>
  3261.         <wideMargins> <false /> </wideMargins>
  3262.         <multipleLines> <false /> </multipleLines>
  3263.         <reservedFamily> 0 </reservedFamily>
  3264.         <titleWidth>0</titleWidth>
  3265.         <icon>0</icon>
  3266.         <textAlign>center</textAlign>
  3267.         <font>Chicago</font>
  3268.         <textSize>12</textSize>
  3269.         <textStyle>plain</textStyle>
  3270.         <textHeight>16</textHeight>
  3271.         <name></name>
  3272.         <script></script>
  3273.     </part>
  3274.     <content>
  3275.         <layer>card</layer>
  3276.         <id>1</id>
  3277.         <text>Gestalt</text>
  3278.     </content>
  3279.     <content>
  3280.         <layer>background</layer>
  3281.         <id>7</id>
  3282.         <text>OSErr TMGestalt()
  3283. {
  3284.   OSErr      error;
  3285.   long      CTBVersion;
  3286.   long      TMAttr;
  3287.   
  3288.   error = Gestalt(gestaltCTBVersion, 
  3289.                     &CTBVersion);
  3290.   if (noErr == error)
  3291.   {
  3292.     if (0x101 > CTBVersion)
  3293.     {
  3294.       error = noErr;
  3295.     }
  3296.     else
  3297.     {
  3298.       error = Gestalt(gestaltTermMgrAttr, 
  3299.                         &TMAttr);
  3300.       if (noErr == error)
  3301.       {
  3302.         if ((TMAttr  &
  3303.             (1 << gestaltTermMgrPresent)))
  3304.         {
  3305.           error = noErr;
  3306.         }
  3307.         else
  3308.         {
  3309.           error = cmGenericError;
  3310.         }
  3311.       }
  3312.   }
  3313.   return error;
  3314. }
  3315. </text>
  3316.     </content>
  3317.     <name>Gestalt</name>
  3318.     <script></script>
  3319. </card>
  3320.  
  3321.  
  3322. card_2504.xml
  3323. <?xml version="1.0" encoding="utf-8" ?>
  3324. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  3325. <card>
  3326.     <id>2504</id>
  3327.     <filler1>0</filler1>
  3328.     <cantDelete> <false /> </cantDelete>
  3329.     <showPict> <true /> </showPict>
  3330.     <dontSearch> <false /> </dontSearch>
  3331.     <owner>2117</owner>
  3332.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  3333.     <part>
  3334.         <id>1</id>
  3335.         <type>field</type>
  3336.         <visible> <false /> </visible>
  3337.         <dontWrap> <false /> </dontWrap>
  3338.         <dontSearch> <false /> </dontSearch>
  3339.         <sharedText> <false /> </sharedText>
  3340.         <fixedLineHeight> <false /> </fixedLineHeight>
  3341.         <autoTab> <false /> </autoTab>
  3342.         <lockText> <true /> </lockText>
  3343.         <rect>
  3344.             <left>130</left>
  3345.             <top>280</top>
  3346.             <right>576</right>
  3347.             <bottom>352</bottom>
  3348.         </rect>
  3349.         <style>scrolling</style>
  3350.         <autoSelect> <false /> </autoSelect>
  3351.         <showLines> <false /> </showLines>
  3352.         <wideMargins> <false /> </wideMargins>
  3353.         <multipleLines> <false /> </multipleLines>
  3354.         <reservedFamily> 0 </reservedFamily>
  3355.         <titleWidth>0</titleWidth>
  3356.         <icon>0</icon>
  3357.         <textAlign>left</textAlign>
  3358.         <font>Geneva</font>
  3359.         <textSize>9</textSize>
  3360.         <textStyle>plain</textStyle>
  3361.         <textHeight>12</textHeight>
  3362.         <name>the 411 info</name>
  3363.         <script></script>
  3364.     </part>
  3365.     <part>
  3366.         <id>2</id>
  3367.         <type>field</type>
  3368.         <visible> <true /> </visible>
  3369.         <dontWrap> <false /> </dontWrap>
  3370.         <dontSearch> <false /> </dontSearch>
  3371.         <sharedText> <false /> </sharedText>
  3372.         <fixedLineHeight> <false /> </fixedLineHeight>
  3373.         <autoTab> <false /> </autoTab>
  3374.         <lockText> <true /> </lockText>
  3375.         <rect>
  3376.             <left>366</left>
  3377.             <top>24</top>
  3378.             <right>463</right>
  3379.             <bottom>41</bottom>
  3380.         </rect>
  3381.         <style>opaque</style>
  3382.         <autoSelect> <false /> </autoSelect>
  3383.         <showLines> <false /> </showLines>
  3384.         <wideMargins> <false /> </wideMargins>
  3385.         <multipleLines> <false /> </multipleLines>
  3386.         <reservedFamily> 0 </reservedFamily>
  3387.         <titleWidth>0</titleWidth>
  3388.         <icon>0</icon>
  3389.         <textAlign>center</textAlign>
  3390.         <font>Chicago</font>
  3391.         <textSize>12</textSize>
  3392.         <textStyle>plain</textStyle>
  3393.         <textHeight>16</textHeight>
  3394.         <name></name>
  3395.         <script></script>
  3396.     </part>
  3397.     <content>
  3398.         <layer>card</layer>
  3399.         <id>2</id>
  3400.         <text>Initialization</text>
  3401.     </content>
  3402.     <content>
  3403.         <layer>card</layer>
  3404.         <id>1</id>
  3405.         <text>√¶KY Gestalt
  3406. #if SystemSevenOrLater
  3407. #pragma parameter __D0 Gestalt(__D0,__A1)
  3408. pascal OSErr Gestalt(OSType selector,long *response)
  3409.     = {0xA1AD,0x2288}; 
  3410. #else
  3411. pascal OSErr Gestalt(OSType selector,long *response);
  3412. #endif
  3413. File {CIncludes}GestaltEqu.h
  3414. Trap number: A1AD,2288
  3415. •
  3416. √¶KY InitTM
  3417. Initializing the Terminal Manager
  3418.  
  3419. Function        InitTM: TMErr;
  3420.  
  3421. Description:    InitTM initializes the Terminal Manager. Your 
  3422.                 application should call this routine after it calls the 
  3423.                 standard Macintosh Toolbox initialization routines.
  3424.  
  3425.                 Warning        Your application must initialize the 
  3426.                 Communications Resource Manager (by calling    InitCRM) 
  3427.                 and then the Communications Toolbox Utilities 
  3428.                 (by calling InitCTBUtilities), whether or not it uses 
  3429.                 any of their calls, before it initializes the Terminal
  3430.                 Manager.      
  3431.  
  3432.                 InitTM returns an operating system error code if 
  3433.                 appropriate. Your application must check for the 
  3434.                 presence of the Communications Toolbox before calling 
  3435.                 this function. Sample code under ‚ÄúDetermining Whether 
  3436.                 the Managers are Installed‚Äù in Appendix C shows you how
  3437.                 your application can make this check.
  3438.  
  3439. Result Codes    tmGenericError, tmNoErr, tmNoTools
  3440. •</text>
  3441.     </content>
  3442.     <name>Initialization</name>
  3443.     <script></script>
  3444. </card>
  3445.  
  3446.  
  3447. card_3013.xml
  3448. <?xml version="1.0" encoding="utf-8" ?>
  3449. <!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
  3450. <card>
  3451.     <id>3013</id>
  3452.     <filler1>0</filler1>
  3453.     <cantDelete> <false /> </cantDelete>
  3454.     <showPict> <true /> </showPict>
  3455.     <dontSearch> <false /> </dontSearch>
  3456.     <owner>2609</owner>
  3457.     <link rel="stylesheet" type="text/css" href="stylesheet_3084.css" />
  3458.     <name>Start</name>
  3459.     <script></script>
  3460. </card>
  3461.  
  3462.  
  3463.